CoreFiles by mySites.guru
CleanupModel.php47 lines, 1,301 bytes, from Joomla_4.4.14-Stable-Full_Package.zip
Raw History Compare with 4.4.13
md5
dc45cf2d58a2a2c3bd8e40b5ed5d6044
sha1
001ab2d17feb3eade7bde27cd9a682b29bcea0c3
sha256
e086293a48d687202b8cc1e648ec1ef689bf83368af9ded4b3520792f2ae1f09
<?php

/**
 * @package     Joomla.Installation
 * @subpackage  Model
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Installation\Model;

use Joomla\CMS\Filesystem\Folder;
use Joomla\Filesystem\File;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Cleanup model for the Joomla Core Installer.
 *
 * @since  4.0.0
 */
class CleanupModel extends BaseInstallationModel
{
    /**
     * Deletes the installation folder. Returns true on success.
     *
     * @return  boolean
     *
     * @since   4.0.0
     */
    public function deleteInstallationFolder()
    {
        $return = Folder::delete(JPATH_INSTALLATION) && (!file_exists(JPATH_ROOT . '/joomla.xml') || File::delete(JPATH_ROOT . '/joomla.xml'));

        // Rename the robots.txt.dist file if robots.txt doesn't exist
        if ($return && !file_exists(JPATH_ROOT . '/robots.txt') && file_exists(JPATH_ROOT . '/robots.txt.dist')) {
            $return = File::move(JPATH_ROOT . '/robots.txt.dist', JPATH_ROOT . '/robots.txt');
        }

        \clearstatcache(true, JPATH_INSTALLATION . '/index.php');

        return $return;
    }
}

The same content is in 44 releases, Joomla 4.4.0-alpha1 to 5.0.0-beta3. See them all, or every version of this file.