Esempio n. 1
0
 /**
  * Modify an existing field
  *
  * @param $table String: name of the table to which the field belongs
  * @param $field String: name of the field to modify
  * @param $patch String: path to the patch file
  * @param $fullpath Boolean: whether to treat $patch path as a relative or not
  */
 public function modifyField($table, $field, $patch, $fullpath = false)
 {
     if (!$this->db->tableExists($table)) {
         $this->output("...{$table} table does not exist, skipping modify field patch\n");
     } elseif (!$this->db->fieldExists($table, $field)) {
         $this->output("...{$field} field does not exist in {$table} table, skipping modify field patch\n");
     } else {
         $this->output("Modifying {$field} field of table {$table}...");
         $this->applyPatch($patch, $fullpath);
         $this->output("ok\n");
     }
 }
Esempio n. 2
0
 /**
  * Update CategoryLinks collation
  */
 protected function doCollationUpdate()
 {
     global $wgCategoryCollation;
     if ($this->db->fieldExists('categorylinks', 'cl_collation', __METHOD__)) {
         if ($this->db->selectField('categorylinks', 'COUNT(*)', 'cl_collation != ' . $this->db->addQuotes($wgCategoryCollation), __METHOD__) == 0) {
             $this->output("...collations up-to-date.\n");
             return;
         }
         $this->output("Updating category collations...");
         $task = $this->maintenance->runChild('UpdateCollation');
         $task->execute();
         $this->output("...done.\n");
     }
 }
Esempio n. 3
0
 /**
  * Modify an existing field
  *
  * @param $table String: name of the table to which the field belongs
  * @param $field String: name of the field to modify
  * @param $patch String: path to the patch file
  * @param $fullpath Boolean: whether to treat $patch path as a relative or not
  */
 public function modifyField($table, $field, $patch, $fullpath = false)
 {
     $updateKey = "{$table}-{$field}-{$patch}";
     if (!$this->db->tableExists($table, __METHOD__)) {
         $this->output("...{$table} table does not exist, skipping modify field patch.\n");
     } elseif (!$this->db->fieldExists($table, $field, __METHOD__)) {
         $this->output("...{$field} field does not exist in {$table} table, skipping modify field patch.\n");
     } elseif ($this->updateRowExists($updateKey)) {
         $this->output("...{$field} in table {$table} already modified by patch {$patch}.\n");
     } else {
         $this->applyPatch($patch, $fullpath, "Modifying {$field} field of table {$table}");
         $this->insertUpdateRow($updateKey);
     }
 }