/**
* Check various permission hooks
- * @see checkQuickPermissions for parameter information
+ *
+ * @param $action String the action to check
+ * @param $user User user to check
+ * @param $errors Array list of current errors
+ * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
+ * @param $short Boolean short circuit on first error
+ *
+ * @return Array list of errors
*/
private function checkPermissionHooks( $action, $user, $errors, $doExpensiveQueries, $short ) {
// Use getUserPermissionsErrors instead
/**
* Check permissions on special pages & namespaces
- * @see checkQuickPermissions for parameter information
+ *
+ * @param $action String the action to check
+ * @param $user User user to check
+ * @param $errors Array list of current errors
+ * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
+ * @param $short Boolean short circuit on first error
+ *
+ * @return Array list of errors
*/
private function checkSpecialsAndNSPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
# Only 'createaccount' and 'execute' can be performed on
/**
* Check CSS/JS sub-page permissions
- * @see checkQuickPermissions for parameter information
+ *
+ * @param $action String the action to check
+ * @param $user User user to check
+ * @param $errors Array list of current errors
+ * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
+ * @param $short Boolean short circuit on first error
+ *
+ * @return Array list of errors
*/
private function checkCSSandJSPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
# Protect css/js subpages of user pages
* Check against page_restrictions table requirements on this
* page. The user must possess all required rights for this
* action.
- * @see checkQuickPermissions for parameter information
+ *
+ * @param $action String the action to check
+ * @param $user User user to check
+ * @param $errors Array list of current errors
+ * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
+ * @param $short Boolean short circuit on first error
+ *
+ * @return Array list of errors
*/
private function checkPageRestrictions( $action, $user, $errors, $doExpensiveQueries, $short ) {
foreach ( $this->getRestrictions( $action ) as $right ) {
/**
* Check restrictions on cascading pages.
- * @see checkQuickPermissions for parameter information
+ *
+ * @param $action String the action to check
+ * @param $user User user to check
+ * @param $errors Array list of current errors
+ * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
+ * @param $short Boolean short circuit on first error
+ *
+ * @return Array list of errors
*/
private function checkCascadingSourcesRestrictions( $action, $user, $errors, $doExpensiveQueries, $short ) {
if ( $doExpensiveQueries && !$this->isCssJsSubpage() ) {
/**
* Check action permissions not already checked in checkQuickPermissions
- * @see checkQuickPermissions for parameter information
+ *
+ * @param $action String the action to check
+ * @param $user User user to check
+ * @param $errors Array list of current errors
+ * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
+ * @param $short Boolean short circuit on first error
+ *
+ * @return Array list of errors
*/
private function checkActionPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
if ( $action == 'protect' ) {
/**
* Check that the user isn't blocked from editting.
- * @see checkQuickPermissions for parameter information
+ *
+ * @param $action String the action to check
+ * @param $user User user to check
+ * @param $errors Array list of current errors
+ * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
+ * @param $short Boolean short circuit on first error
+ *
+ * @return Array list of errors
*/
private function checkUserBlock( $action, $user, $errors, $doExpensiveQueries, $short ) {
if( $short && count( $errors ) > 0 ) {
/**
* Is this a *valid* .css or .js subpage of a user page?
- * Check that the corresponding skin exists
*
* @return \type{\bool}
+ * @deprecated
*/
public function isValidCssJsSubpage() {
- if ( $this->isCssJsSubpage() ) {
- $name = $this->getSkinFromCssJsSubpage();
- if ( $name == 'common' ) {
- return true;
- }
- $skinNames = Skin::getSkinNames();
- return array_key_exists( $name, $skinNames );
- } else {
- return false;
- }
+ return $this->isCssJsSubpage();
}
/**
$this->mInterwiki = $wgContLang->lc( $p );
# Redundant interwiki prefix to the local wiki
- if ( 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) ) {
+ if ( $wgLocalInterwiki !== false
+ && 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) )
+ {
if ( $dbkey == '' ) {
# Can't have an empty self-link
return false;
# Truncate for whole multibyte characters. +5 bytes for ellipsis
$comment = $wgContLang->truncate( $comment, 250 );
- $newid = $nt->getArticleID();
$oldid = $this->getArticleID();
$latest = $this->getLatestRevId();
*/
public function countRevisionsBetween( $old, $new ) {
$dbr = wfGetDB( DB_SLAVE );
- return (int)$dbr->selectField( 'revision', 'count(*)',
- 'rev_page = ' . intval( $this->getArticleId() ) .
- ' AND rev_id > ' . intval( $old ) .
- ' AND rev_id < ' . intval( $new ),
- __METHOD__
+ return (int)$dbr->selectField( 'revision', 'count(*)', array(
+ 'rev_page' => intval( $this->getArticleId() ),
+ 'rev_id > ' . intval( $old ),
+ 'rev_id < ' . intval( $new )
+ ), __METHOD__
);
}
$db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
$res = $db->select( 'revision', 'DISTINCT rev_user_text',
array(
- 'rev_page = ' . $this->getArticleID(),
+ 'rev_page' => $this->getArticleID(),
'rev_id > ' . (int)$fromRevId,
'rev_id < ' . (int)$toRevId
), __METHOD__,