Merge "Set up local date formats for Sorani Kurdish (ckb)"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 7 Dec 2013 21:12:48 +0000 (21:12 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 7 Dec 2013 21:12:48 +0000 (21:12 +0000)
includes/Defines.php
includes/Revision.php

index 86c5520..7c71fe7 100644 (file)
@@ -120,16 +120,27 @@ define( 'CACHE_DBA', 4 );        // Use PHP's DBA extension to store in a DBM-st
  * Media types.
  * This defines constants for the value returned by File::getMediaType()
  */
-define( 'MEDIATYPE_UNKNOWN',    'UNKNOWN' );     // unknown format
-define( 'MEDIATYPE_BITMAP',     'BITMAP' );      // some bitmap image or image source (like psd, etc). Can't scale up.
-define( 'MEDIATYPE_DRAWING',    'DRAWING' );     // some vector drawing (SVG, WMF, PS, ...) or image source (oo-draw, etc). Can scale up.
-define( 'MEDIATYPE_AUDIO',      'AUDIO' );       // simple audio file (ogg, mp3, wav, midi, whatever)
-define( 'MEDIATYPE_VIDEO',      'VIDEO' );       // simple video file (ogg, mpg, etc; no not include formats here that may contain executable sections or scripts!)
-define( 'MEDIATYPE_MULTIMEDIA', 'MULTIMEDIA' );  // Scriptable Multimedia (flash, advanced video container formats, etc)
-define( 'MEDIATYPE_OFFICE',     'OFFICE' );      // Office Documents, Spreadsheets (office formats possibly containing apples, scripts, etc)
-define( 'MEDIATYPE_TEXT',       'TEXT' );        // Plain text (possibly containing program code or scripts)
-define( 'MEDIATYPE_EXECUTABLE', 'EXECUTABLE' );  // binary executable
-define( 'MEDIATYPE_ARCHIVE',    'ARCHIVE' );     // archive file (zip, tar, etc)
+// unknown format
+define( 'MEDIATYPE_UNKNOWN', 'UNKNOWN' );
+// some bitmap image or image source (like psd, etc). Can't scale up.
+define( 'MEDIATYPE_BITMAP', 'BITMAP' );
+// some vector drawing (SVG, WMF, PS, ...) or image source (oo-draw, etc). Can scale up.
+define( 'MEDIATYPE_DRAWING', 'DRAWING' );
+// simple audio file (ogg, mp3, wav, midi, whatever)
+define( 'MEDIATYPE_AUDIO', 'AUDIO' );
+// simple video file (ogg, mpg, etc;
+// no not include formats here that may contain executable sections or scripts!)
+define( 'MEDIATYPE_VIDEO', 'VIDEO' );
+// Scriptable Multimedia (flash, advanced video container formats, etc)
+define( 'MEDIATYPE_MULTIMEDIA', 'MULTIMEDIA' );
+// Office Documents, Spreadsheets (office formats possibly containing apples, scripts, etc)
+define( 'MEDIATYPE_OFFICE', 'OFFICE' );
+// Plain text (possibly containing program code or scripts)
+define( 'MEDIATYPE_TEXT', 'TEXT' );
+// binary executable
+define( 'MEDIATYPE_EXECUTABLE', 'EXECUTABLE' );
+// archive file (zip, tar, etc)
+define( 'MEDIATYPE_ARCHIVE', 'ARCHIVE' );
 /**@}*/
 
 /**@{
@@ -288,12 +299,20 @@ define( 'CONTENT_MODEL_TEXT', 'text' );
  * Extensions are free to use the below formats, or define their own.
  * It is recommended to stick with the conventions for MIME types.
  */
-define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' ); // wikitext
-define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' ); // for js pages
-define( 'CONTENT_FORMAT_CSS', 'text/css' );  // for css pages
-define( 'CONTENT_FORMAT_TEXT', 'text/plain' ); // for future use, e.g. with some plain-html messages.
-define( 'CONTENT_FORMAT_HTML', 'text/html' ); // for future use, e.g. with some plain-html messages.
-define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' ); // for future use with the api and for extensions
-define( 'CONTENT_FORMAT_JSON', 'application/json' ); // for future use with the api, and for use by extensions
-define( 'CONTENT_FORMAT_XML', 'application/xml' ); // for future use with the api, and for use by extensions
+// wikitext
+define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
+// for js pages
+define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
+// for css pages
+define( 'CONTENT_FORMAT_CSS', 'text/css' );
+// for future use, e.g. with some plain-html messages.
+define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
+// for future use, e.g. with some plain-html messages.
+define( 'CONTENT_FORMAT_HTML', 'text/html' );
+// for future use with the api and for extensions
+define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
+// for future use with the api, and for use by extensions
+define( 'CONTENT_FORMAT_JSON', 'application/json' );
+// for future use with the api, and for use by extensions
+define( 'CONTENT_FORMAT_XML', 'application/xml' );
 /**@}*/
index 6ab3df4..f066110 100644 (file)
@@ -530,14 +530,14 @@ class Revision implements IDBAccessObject {
         */
        function __construct( $row ) {
                if ( is_object( $row ) ) {
-                       $this->mId        = intval( $row->rev_id );
-                       $this->mPage      = intval( $row->rev_page );
-                       $this->mTextId    = intval( $row->rev_text_id );
-                       $this->mComment   =         $row->rev_comment;
-                       $this->mUser      = intval( $row->rev_user );
+                       $this->mId = intval( $row->rev_id );
+                       $this->mPage = intval( $row->rev_page );
+                       $this->mTextId = intval( $row->rev_text_id );
+                       $this->mComment = $row->rev_comment;
+                       $this->mUser = intval( $row->rev_user );
                        $this->mMinorEdit = intval( $row->rev_minor_edit );
-                       $this->mTimestamp =         $row->rev_timestamp;
-                       $this->mDeleted   = intval( $row->rev_deleted );
+                       $this->mTimestamp = $row->rev_timestamp;
+                       $this->mDeleted = intval( $row->rev_deleted );
 
                        if ( !isset( $row->rev_parent_id ) ) {
                                $this->mParentId = null;
@@ -612,27 +612,31 @@ class Revision implements IDBAccessObject {
                                # also set text to null?
                        }
 
-                       $this->mId        = isset( $row['id']         ) ? intval( $row['id']         ) : null;
-                       $this->mPage      = isset( $row['page']       ) ? intval( $row['page']       ) : null;
-                       $this->mTextId    = isset( $row['text_id']    ) ? intval( $row['text_id']    ) : null;
-                       $this->mUserText  = isset( $row['user_text']  ) ? strval( $row['user_text']  ) : $wgUser->getName();
-                       $this->mUser      = isset( $row['user']       ) ? intval( $row['user']       ) : $wgUser->getId();
+                       $this->mId = isset( $row['id'] ) ? intval( $row['id'] ) : null;
+                       $this->mPage = isset( $row['page'] ) ? intval( $row['page'] ) : null;
+                       $this->mTextId = isset( $row['text_id'] ) ? intval( $row['text_id'] ) : null;
+                       $this->mUserText = isset( $row['user_text'] )
+                               ? strval( $row['user_text'] ) : $wgUser->getName();
+                       $this->mUser = isset( $row['user'] ) ? intval( $row['user'] ) : $wgUser->getId();
                        $this->mMinorEdit = isset( $row['minor_edit'] ) ? intval( $row['minor_edit'] ) : 0;
-                       $this->mTimestamp = isset( $row['timestamp']  ) ? strval( $row['timestamp']  ) : wfTimestampNow();
-                       $this->mDeleted   = isset( $row['deleted']    ) ? intval( $row['deleted']    ) : 0;
-                       $this->mSize      = isset( $row['len']        ) ? intval( $row['len']        ) : null;
-                       $this->mParentId  = isset( $row['parent_id']  ) ? intval( $row['parent_id']  ) : null;
-                       $this->mSha1      = isset( $row['sha1']  )      ? strval( $row['sha1']  )      : null;
-
-                       $this->mContentModel   = isset( $row['content_model']  )  ? strval( $row['content_model'] )  : null;
-                       $this->mContentFormat  = isset( $row['content_format']  ) ? strval( $row['content_format'] ) : null;
+                       $this->mTimestamp = isset( $row['timestamp'] )
+                               ? strval( $row['timestamp'] ) : wfTimestampNow();
+                       $this->mDeleted = isset( $row['deleted'] ) ? intval( $row['deleted'] ) : 0;
+                       $this->mSize = isset( $row['len'] ) ? intval( $row['len'] ) : null;
+                       $this->mParentId = isset( $row['parent_id'] ) ? intval( $row['parent_id'] ) : null;
+                       $this->mSha1 = isset( $row['sha1'] ) ? strval( $row['sha1'] ) : null;
+
+                       $this->mContentModel = isset( $row['content_model'] )
+                               ? strval( $row['content_model'] ) : null;
+                       $this->mContentFormat = isset( $row['content_format'] )
+                               ? strval( $row['content_format'] ) : null;
 
                        // Enforce spacing trimming on supplied text
-                       $this->mComment   = isset( $row['comment']    ) ?  trim( strval( $row['comment'] ) ) : null;
-                       $this->mText      = isset( $row['text']       ) ? rtrim( strval( $row['text']    ) ) : null;
-                       $this->mTextRow   = null;
+                       $this->mComment = isset( $row['comment'] ) ? trim( strval( $row['comment'] ) ) : null;
+                       $this->mText = isset( $row['text'] ) ? rtrim( strval( $row['text'] ) ) : null;
+                       $this->mTextRow = null;
 
-                       $this->mTitle     = isset( $row['title']      ) ? $row['title'] : null;
+                       $this->mTitle = isset( $row['title'] ) ? $row['title'] : null;
 
                        // if we have a Content object, override mText and mContentModel
                        if ( !empty( $row['content'] ) ) {
@@ -757,7 +761,8 @@ class Revision implements IDBAccessObject {
                if ( isset( $this->mTitle ) ) {
                        return $this->mTitle;
                }
-               if ( !is_null( $this->mId ) ) { //rev_id is defined as NOT NULL, but this revision may not yet have been inserted.
+               //rev_id is defined as NOT NULL, but this revision may not yet have been inserted.
+               if ( !is_null( $this->mId ) ) {
                        $dbr = wfGetDB( DB_SLAVE );
                        $row = $dbr->selectRow(
                                array( 'page', 'revision' ),
@@ -1081,7 +1086,8 @@ class Revision implements IDBAccessObject {
         * used to determine the content model to use. If no title is know, CONTENT_MODEL_WIKITEXT
         * is used as a last resort.
         *
-        * @return String the content model id associated with this revision, see the CONTENT_MODEL_XXX constants.
+        * @return String the content model id associated with this revision,
+        *     see the CONTENT_MODEL_XXX constants.
         **/
        public function getContentModel() {
                if ( !$this->mContentModel ) {
@@ -1100,7 +1106,8 @@ class Revision implements IDBAccessObject {
         * If no content format was stored in the database, the default format for this
         * revision's content model is returned.
         *
-        * @return String the content format id associated with this revision, see the CONTENT_FORMAT_XXX constants.
+        * @return String the content format id associated with this revision,
+        *     see the CONTENT_FORMAT_XXX constants.
         **/
        public function getContentFormat() {
                if ( !$this->mContentFormat ) {
@@ -1127,7 +1134,8 @@ class Revision implements IDBAccessObject {
                        $format = $this->getContentFormat();
 
                        if ( !$this->mContentHandler->isSupportedFormat( $format ) ) {
-                               throw new MWException( "Oops, the content format $format is not supported for this content model, $model" );
+                               throw new MWException( "Oops, the content format $format is not supported for "
+                                       . "this content model, $model" );
                        }
                }
 
@@ -1398,7 +1406,8 @@ class Revision implements IDBAccessObject {
 
                if ( $wgContentHandlerUseDB ) {
                        //NOTE: Store null for the default model and format, to save space.
-                       //XXX: Makes the DB sensitive to changed defaults. Make this behavior optional? Only in miser mode?
+                       //XXX: Makes the DB sensitive to changed defaults.
+                       // Make this behavior optional? Only in miser mode?
 
                        $model = $this->getContentModel();
                        $format = $this->getContentFormat();
@@ -1407,7 +1416,8 @@ class Revision implements IDBAccessObject {
 
                        if ( $title === null ) {
                                wfProfileOut( __METHOD__ );
-                               throw new MWException( "Insufficient information to determine the title of the revision's page!" );
+                               throw new MWException( "Insufficient information to determine the title of the "
+                                       . "revision's page!" );
                        }
 
                        $defaultModel = ContentHandler::getDefaultModelFor( $title );
@@ -1443,7 +1453,8 @@ class Revision implements IDBAccessObject {
                }
 
                if ( !$wgContentHandlerUseDB && $title ) {
-                       // if $wgContentHandlerUseDB is not set, all revisions must use the default content model and format.
+                       // if $wgContentHandlerUseDB is not set,
+                       // all revisions must use the default content model and format.
 
                        $defaultModel = ContentHandler::getDefaultModelFor( $title );
                        $defaultHandler = ContentHandler::getForModelID( $defaultModel );
@@ -1452,15 +1463,17 @@ class Revision implements IDBAccessObject {
                        if ( $this->getContentModel() != $defaultModel ) {
                                $t = $title->getPrefixedDBkey();
 
-                               throw new MWException( "Can't save non-default content model with \$wgContentHandlerUseDB disabled: "
-                                       . "model is $model, default for $t is $defaultModel" );
+                               throw new MWException( "Can't save non-default content model with "
+                                       . "\$wgContentHandlerUseDB disabled: model is $model, "
+                                       . "default for $t is $defaultModel" );
                        }
 
                        if ( $this->getContentFormat() != $defaultFormat ) {
                                $t = $title->getPrefixedDBkey();
 
-                               throw new MWException( "Can't use non-default content format with \$wgContentHandlerUseDB disabled: "
-                                       . "format is $format, default for $t is $defaultFormat" );
+                               throw new MWException( "Can't use non-default content format with "
+                                       . "\$wgContentHandlerUseDB disabled: format is $format, "
+                                       . "default for $t is $defaultFormat" );
                        }
                }
 
@@ -1722,8 +1735,8 @@ class Revision implements IDBAccessObject {
         *
         * @since 1.20
         *
-        * @param DatabaseBase|int $db the Database to perform the check on. May be given as a Database object or
-        *        a database identifier usable with wfGetDB.
+        * @param DatabaseBase|int $db the Database to perform the check on. May be given as a
+        *        Database object or a database identifier usable with wfGetDB.
         * @param int $pageId the ID of the page in question
         * @param int $userId the ID of the user in question
         * @param string $since look at edits since this time