[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/installation/src/Model/ -> CleanupModel.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Installation
   5   * @subpackage  Model
   6   *
   7   * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\CMS\Installation\Model;
  12  
  13  use Joomla\CMS\Filesystem\File;
  14  use Joomla\CMS\Filesystem\Folder;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * Cleanup model for the Joomla Core Installer.
  22   *
  23   * @since  4.0.0
  24   */
  25  class CleanupModel extends BaseInstallationModel
  26  {
  27      /**
  28       * Deletes the installation folder. Returns true on success.
  29       *
  30       * @return  boolean
  31       *
  32       * @since   4.0.0
  33       */
  34      public function deleteInstallationFolder()
  35      {
  36          $return = Folder::delete(JPATH_INSTALLATION) && (!file_exists(JPATH_ROOT . '/joomla.xml') || File::delete(JPATH_ROOT . '/joomla.xml'));
  37  
  38          // Rename the robots.txt.dist file if robots.txt doesn't exist
  39          if ($return && !file_exists(JPATH_ROOT . '/robots.txt') && file_exists(JPATH_ROOT . '/robots.txt.dist')) {
  40              $return = File::move(JPATH_ROOT . '/robots.txt.dist', JPATH_ROOT . '/robots.txt');
  41          }
  42  
  43          \clearstatcache(true, JPATH_INSTALLATION . '/index.php');
  44  
  45          return $return;
  46      }
  47  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer