コード例 #1
0
 /**
  * Rolls back any changes made to the DB during the update process.
  *
  * @param $backupPath
  *
  * @return null
  */
 public static function rollBackDatabaseChanges($backupPath)
 {
     $dbBackup = new DbBackup();
     $fileName = $backupPath . '.sql';
     $fullBackupPath = craft()->path->getDbBackupPath() . $fileName;
     if (PathHelper::ensurePathIsContained($fileName)) {
         $dbBackup->restore($fullBackupPath);
     } else {
         Craft::log('Someone tried to restore a database from outside of the Craft backups folder: ' . $fullBackupPath, LogLevel::Warning);
     }
 }
コード例 #2
0
 /**
  * Rolls back any changes made to the DB during the update process.
  *
  * @param $backupPath
  *
  * @return null
  */
 public static function rollBackDatabaseChanges($backupPath)
 {
     $dbBackup = new DbBackup();
     $fullBackupPath = craft()->path->getDbBackupPath() . $backupPath . '.sql';
     $dbBackup->restore($fullBackupPath);
 }