/** * Clears the list of sites stored in the database. * * @see SiteStore::clear() * * @return bool Success */ public function clear() { $dbw = $this->sitesTable->getWriteDbConnection(); $dbw->startAtomic(__METHOD__); $ok = $dbw->delete('sites', '*', __METHOD__); $ok = $dbw->delete('site_identifiers', '*', __METHOD__) && $ok; $dbw->endAtomic(__METHOD__); $this->reset(); return $ok; }
protected function handleRow($row) { $template_params = array(); $field_num = 0; foreach ($row as $field) { $field_num++; $key = $field->getPrintRequest()->getLabel(); if (empty($key)) { $key = $field_num; } $value = array(); while (($object = $field->getNextDataValue()) !== false) { $value[] = Sanitizer::decodeCharReferences($object->getWikiValue()); } $template_params[$key] = $value; } if (isset($template_params['To']) && count($template_params['To']) > 0) { $data = array('title' => $this->pageTitle, 'params' => $template_params, 'template' => $this->params['template']); $row = $this->emailsTable->newRow($data); $row->save(); } }
/** * Return if any fields got changed. * * @since 1.20 * * @param IORMRow $object * @param boolean|array $excludeSummaryFields * When set to true, summary field changes are ignored. * Can also be an array of fields to ignore. * * @return boolean */ protected function fieldsChanged(IORMRow $object, $excludeSummaryFields = false) { $exclusionFields = array(); if ($excludeSummaryFields !== false) { $exclusionFields = is_array($excludeSummaryFields) ? $excludeSummaryFields : $this->table->getSummaryFields(); } foreach ($this->fields as $name => $value) { $excluded = $excludeSummaryFields && in_array($name, $exclusionFields); if (!$excluded && $object->getField($name) !== $value) { return true; } } return false; }
/** * Clears the list of sites stored in the database. * * @see SiteStore::clear() * * @return bool success */ public function clear() { wfProfileIn(__METHOD__); $dbw = $this->sitesTable->getWriteDbConnection(); $trx = $dbw->trxLevel(); if ($trx == 0) { $dbw->begin(__METHOD__); } $ok = $dbw->delete('sites', '*', __METHOD__); $ok = $dbw->delete('site_identifiers', '*', __METHOD__) && $ok; if ($trx == 0) { $dbw->commit(__METHOD__); } $this->reset(); wfProfileOut(__METHOD__); return $ok; }
/** * Return the names of the fields. * * @since 1.20 * @deprecated since 1.22 * * @return array */ public function getFieldNames() { return array_keys($this->table->getFields()); }
public function __construct($tableName = '', array $fields = array(), array $defaults = array(), $rowClass = null, $fieldPrefix = '') { $tableName = 'smw_mailmerge'; $fields = array('id' => 'id', 'title' => 'str', 'template' => 'str', 'params' => 'array'); parent::__construct($tableName, $fields, $defaults, $rowClass, $fieldPrefix); }