concrete/src/Package/Package.php
public function backup()
    {
        $packageHandle = $this->getPackageHandle();
        $errors = $this->app->make('error');
        if ($packageHandle === '' || !is_dir(DIR_PACKAGES . '/' . $packageHandle)) {
            $errors->add($this->getErrorText(self::E_PACKAGE_NOT_FOUND));
        } else {
            $config = $this->app->make('config');
            $trash = $config->get('concrete.misc.package_backup_directory');
            if (!is_dir($trash)) {
                @mkdir($trash, $config->get('concrete.filesystem.permissions.directory'));
            }
            if (!is_dir($trash)) {
                $errors->add($this->getErrorText(self::E_PACKAGE_MIGRATE_BACKUP));
            } else {
                $trashName = $trash . '/' . $packageHandle . '_' . date('YmdHis');
                if (!@rename(DIR_PACKAGES . '/' . $this->getPackageHandle(), $trashName)) {
                    $errors->add($this->getErrorText(self::E_PACKAGE_MIGRATE_BACKUP));
                } else {
                    $this->backedUpFname = $trashName;
                }
            }
        }

        return $errors->has() ? $errors : $this;
    }
public function backup()
    {
        $packageHandle = $this->getPackageHandle();
        $errors = $this->app->make('error');
        if ($packageHandle === '' || !is_dir(DIR_PACKAGES . '/' . $packageHandle)) {
            $errors->add($this->getErrorText(self::E_PACKAGE_NOT_FOUND));
        } else {
            $config = $this->app->make('config');
            $trash = $config->get('concrete.misc.package_backup_directory');
            if (!is_dir($trash)) {
                @mkdir($trash, $config->get('concrete.filesystem.permissions.directory'));
            }
            if (!is_dir($trash)) {
                $errors->add($this->getErrorText(self::E_PACKAGE_MIGRATE_BACKUP));
            } else {
                $trashName = $trash . '/' . $packageHandle . '_' . date('YmdHis');
                if (!@rename(DIR_PACKAGES . '/' . $this->getPackageHandle(), $trashName)) {
                    $errors->add($this->getErrorText(self::E_PACKAGE_MIGRATE_BACKUP));
                } else {
                    $this->backedUpFname = $trashName;
                }
            }
        }

        return $errors->has() ? $errors : $this;
    }
public function backup ( ) { $ packageHandle = $ this -> getPackageHandle ( ) ; $ errors = $ this -> app -> make ( 'error' ) ; if ( $ packageHandle === '' || ! is_dir ( DIR_PACKAGES . '/' . $ packageHandle ) ) { $ errors -> add ( $ this -> getErrorText ( self :: E_PACKAGE_NOT_FOUND ) ) ; } else { $ config = $ this -> app -> make ( 'config' ) ; $ trash = $ config -> get ( 'concrete.misc.package_backup_directory' ) ; if ( ! is_dir ( $ trash ) ) { @ mkdir ( $ trash , $ config -> get ( 'concrete.filesystem.permissions.directory' ) ) ; } if ( ! is_dir ( $ trash ) ) { $ errors -> add ( $ this -> getErrorText ( self :: E_PACKAGE_MIGRATE_BACKUP ) ) ; } else { $ trashName = $ trash . '/' . $ packageHandle . '_' . date ( 'YmdHis' ) ; if ( ! @ rename ( DIR_PACKAGES . '/' . $ this -> getPackageHandle ( ) , $ trashName ) ) { $ errors -> add ( $ this -> getErrorText ( self :: E_PACKAGE_MIGRATE_BACKUP ) ) ; } else { $ this -> backedUpFname = $ trashName ; } } } return $ errors -> has ( ) ? $ errors : $ this ; }
Move the current package directory to the trash directory, and rename it with the package handle and a date code.

@return \Concrete\Core\Error\ErrorList\ErrorList|static return the Package instance if the package has been moved, an ErrorList instance otherwise
Move the current package directory to the trash directory and rename it with the package handle and a date code .