/** * Constructor * * @param bool $withTransaction Whether this update should be wrapped in a * transaction (default: true). A transaction is only started if no * transaction is already in progress, see beginTransaction() for details. */ public function __construct($withTransaction = true) { parent::__construct(); $this->mDb = wfGetLB()->getLazyConnectionRef(DB_MASTER); $this->mWithTransaction = $withTransaction; $this->mHasTransaction = false; }
/** * Constructor * * @param bool $withTransaction whether this update should be wrapped in a transaction (default: true). * A transaction is only started if no transaction is already in progress, * see beginTransaction() for details. **/ public function __construct($withTransaction = true) { global $wgAntiLockFlags; parent::__construct(); if ($wgAntiLockFlags & ALF_NO_LINK_LOCK) { $this->mOptions = array(); } else { $this->mOptions = array('FOR UPDATE'); } // @todo get connection only when it's needed? make sure that doesn't break anything, especially transactions! $this->mDb = wfGetDB(DB_MASTER); $this->mWithTransaction = $withTransaction; $this->mHasTransaction = false; }
/** * @param WikiPage $page Page we are updating * @param integer|null $pageId ID of the page we are updating [optional] * @param string|null $timestamp TS_MW timestamp of deletion * @throws MWException */ function __construct(WikiPage $page, $pageId = null, $timestamp = null) { parent::__construct(); $this->page = $page; if ($pageId) { $this->pageId = $pageId; // page ID at time of deletion } elseif ($page->exists()) { $this->pageId = $page->getId(); } else { throw new InvalidArgumentException("Page ID not known. Page doesn't exist?"); } $this->timestamp = $timestamp ?: wfTimestampNow(); }
public function __construct() { parent::__construct(); $this->mDb = wfGetLB()->getLazyConnectionRef(DB_MASTER); }
/** * Constructor * * @param Title $title Title of the page we're updating * @param ParserOutput $parserOutput Output from a full parse of this page * @param bool $recursive Queue jobs for recursive updates? * @throws MWException */ function __construct(Title $title, ParserOutput $parserOutput, $recursive = true) { parent::__construct(); $this->mTitle = $title; $this->mId = $title->getArticleID(Title::GAID_FOR_UPDATE); if (!$this->mId) { throw new InvalidArgumentException("The Title object yields no ID. Perhaps the page doesn't exist?"); } $this->mParserOutput = $parserOutput; $this->mLinks = $parserOutput->getLinks(); $this->mImages = $parserOutput->getImages(); $this->mTemplates = $parserOutput->getTemplates(); $this->mExternals = $parserOutput->getExternalLinks(); $this->mCategories = $parserOutput->getCategories(); $this->mProperties = $parserOutput->getProperties(); $this->mInterwikis = $parserOutput->getInterwikiLinks(); # Convert the format of the interlanguage links # I didn't want to change it in the ParserOutput, because that array is passed all # the way back to the skin, so either a skin API break would be required, or an # inefficient back-conversion. $ill = $parserOutput->getLanguageLinks(); $this->mInterlangs = []; foreach ($ill as $link) { list($key, $title) = explode(':', $link, 2); $this->mInterlangs[$key] = $title; } foreach ($this->mCategories as &$sortkey) { # If the sortkey is longer then 255 bytes, # it truncated by DB, and then doesn't get # matched when comparing existing vs current # categories, causing bug 25254. # Also. substr behaves weird when given "". if ($sortkey !== '') { $sortkey = substr($sortkey, 0, 255); } } $this->mRecursive = $recursive; Hooks::run('LinksUpdateConstructed', [&$this]); }