'CsvStatsOutput' => __DIR__ . '/maintenance/language/StatOutputs.php',
'CurlHttpRequest' => __DIR__ . '/includes/HttpFunctions.php',
'DBAccessBase' => __DIR__ . '/includes/dao/DBAccessBase.php',
- 'DBAccessError' => __DIR__ . '/includes/db/loadbalancer/LBFactory.php',
+ 'DBAccessError' => __DIR__ . '/includes/db/DatabaseError.php',
'DBAccessObjectUtils' => __DIR__ . '/includes/dao/DBAccessObjectUtils.php',
'DBConnRef' => __DIR__ . '/includes/db/DBConnRef.php',
'DBConnectionError' => __DIR__ . '/includes/db/DatabaseError.php',
'DBMasterPos' => __DIR__ . '/includes/db/DatabaseUtility.php',
'DBQueryError' => __DIR__ . '/includes/db/DatabaseError.php',
'DBReadOnlyError' => __DIR__ . '/includes/db/DatabaseError.php',
- 'DBReplicationWaitError' => __DIR__ . '/includes/db/loadbalancer/LBFactory.php',
+ 'DBReplicationWaitError' => __DIR__ . '/includes/db/DatabaseError.php',
'DBSiteStore' => __DIR__ . '/includes/site/DBSiteStore.php',
'DBTransactionError' => __DIR__ . '/includes/db/DatabaseError.php',
'DBUnexpectedError' => __DIR__ . '/includes/db/DatabaseError.php',
&$user: the user that deleted the article
$reason: the reason the article was deleted
$id: id of the article that was deleted
-$content: the Content of the deleted page
+$content: the Content of the deleted page (or null, when deleting a broken page)
$logEntry: the ManualLogEntry used to record the deletion
$archivedRevisionCount: the number of revisions archived during the deletion
specific to a content model should be provided by the respective Content's
getDeletionUpdates() method.
$page: the WikiPage
-$content: the Content to generate updates for
+$content: the Content to generate updates for (or null, if the Content could not be loaded
+due to an error)
&$updates: the array of DataUpdate objects. Hook function may want to add to it.
'XmlDumpWriterOpenPage': Called at the end of XmlDumpWriter::openPage, to allow
*/
class DBTransactionError extends DBExpectedError {
}
+
+/**
+ * Exception class for attempted DB access
+ * @ingroup Database
+ */
+class DBAccessError extends DBUnexpectedError {
+ public function __construct() {
+ parent::__construct( "Mediawiki tried to access the database via wfGetDB(). " .
+ "This is not allowed, because database access has been disabled." );
+ }
+}
+
+/**
+ * Exception class for replica DB wait timeouts
+ * @ingroup Database
+ */
+class DBReplicationWaitError extends DBUnexpectedError {
+}
}
}
-
-/**
- * Exception class for attempted DB access
- */
-class DBAccessError extends MWException {
- public function __construct() {
- parent::__construct( "Mediawiki tried to access the database via wfGetDB(). " .
- "This is not allowed, because database access has been disabled." );
- }
-}
-
-/**
- * Exception class for replica DB wait timeouts
- */
-class DBReplicationWaitError extends Exception {
-}
*/
private $linkDeletions = null;
+ /**
+ * @var null|array Added properties if calculated.
+ */
+ private $propertyInsertions = null;
+
+ /**
+ * @var null|array Deleted properties if calculated.
+ */
+ private $propertyDeletions = null;
+
/**
* @var User|null
*/
# Page properties
$existing = $this->getExistingProperties();
- $propertiesDeletes = $this->getPropertyDeletions( $existing );
- $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes,
+ $this->propertyDeletions = $this->getPropertyDeletions( $existing );
+ $this->incrTableUpdate( 'page_props', 'pp', $this->propertyDeletions,
$this->getPropertyInsertions( $existing ) );
# Invalidate the necessary pages
- $changed = $propertiesDeletes + array_diff_assoc( $this->mProperties, $existing );
+ $this->propertyInsertions = array_diff_assoc( $this->mProperties, $existing );
+ $changed = $this->propertyDeletions + $this->propertyInsertions;
$this->invalidateProperties( $changed );
# Refresh links of all pages including this page
return $result;
}
+ /**
+ * Fetch page properties added by this LinksUpdate.
+ * Only available after the update is complete.
+ * @since 1.28
+ * @return null|array
+ */
+ public function getAddedProperties() {
+ return $this->propertyInsertions;
+ }
+
+ /**
+ * Fetch page properties removed by this LinksUpdate.
+ * Only available after the update is complete.
+ * @since 1.28
+ * @return null|array
+ */
+ public function getRemovedProperties() {
+ return $this->propertyDeletions;
+ }
+
/**
* Update links table freshness
*/
// unless they actually try to catch exceptions (which is rare).
// we need to remember the old content so we can use it to generate all deletion updates.
- $content = $this->getContent( Revision::RAW );
+ try {
+ $content = $this->getContent( Revision::RAW );
+ } catch ( Exception $ex ) {
+ wfLogWarning( __METHOD__ . ': failed to load content during deletion! '
+ . $ex->getMessage() );
+
+ $content = null;
+ }
// Bitfields to further suppress the content
if ( $suppress ) {
* may already return null when the page proper was deleted.
*/
public function doDeleteUpdates( $id, Content $content = null ) {
+ try {
+ $countable = $this->isCountable();
+ } catch ( Exception $ex ) {
+ // fallback for deleting broken pages for which we cannot load the content for
+ // some reason. Note that doDeleteArticleReal() already logged this problem.
+ $countable = false;
+ }
+
// Update site status
- DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, - (int)$this->isCountable(), -1 ) );
+ DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, - (int)$countable, -1 ) );
// Delete pagelinks, update secondary indexes, etc
$updates = $this->getDeletionUpdates( $content );
if ( !$content ) {
// load content object, which may be used to determine the necessary updates.
// XXX: the content may not be needed to determine the updates.
- $content = $this->getContent( Revision::RAW );
+ try {
+ $content = $this->getContent( Revision::RAW );
+ } catch ( Exception $ex ) {
+ // If we can't load the content, something is wrong. Perhaps that's why
+ // the user is trying to delete the page, so let's not fail in that case.
+ // Note that doDeleteArticleReal() will already have logged an issue with
+ // loading the content.
+ }
}
if ( !$content ) {