/** * Applies a SQL patch * @param $path String Path to the patch file * @param $isFullPath Boolean Whether to treat $path as a relative or not */ protected function applyPatch($path, $isFullPath = false) { if ($isFullPath) { $this->db->sourceFile($path); } else { $this->db->sourceFile($this->db->patchPath($path)); } }
/** * Applies a SQL patch * @param $path String Path to the patch file * @param $isFullPath Boolean Whether to treat $path as a relative or not * @param $msg String Description of the patch */ protected function applyPatch($path, $isFullPath = false, $msg = null) { if ($msg === null) { $msg = "Applying {$path} patch"; } if (!$isFullPath) { $path = $this->db->patchPath($path); } $this->output("{$msg} ..."); $this->db->sourceFile($path); $this->output("done.\n"); }
public function execute() { $dbw = wfGetDB(DB_MASTER); foreach ($this->mArgs as $arg) { $files = array($arg, DatabaseBase::patchPath($arg), DatabaseBase::patchPath("patch-{$arg}.sql")); foreach ($files as $file) { if (file_exists($file)) { $this->output("{$file} ...\n"); $dbw->sourceFile($file); continue 2; } } $this->error("Could not find {$arg}\n"); } $this->output("done.\n"); }
/** * Applies a SQL patch * * @param string $path Path to the patch file * @param bool $isFullPath Whether to treat $path as a relative or not * @param string $msg Description of the patch * @return bool False if patch is skipped. */ protected function applyPatch($path, $isFullPath = false, $msg = null) { if ($msg === null) { $msg = "Applying {$path} patch"; } if ($this->skipSchema) { $this->output("...skipping schema change ({$msg}).\n"); return false; } $this->output("{$msg} ..."); if (!$isFullPath) { $path = $this->db->patchPath($path); } if ($this->fileHandle !== null) { $this->copyFile($path); } else { $this->db->sourceFile($path); } $this->output("done.\n"); return true; }