tosfos has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/225345

Change subject: Use UID generator from core, whitespace fixes
......................................................................

Use UID generator from core, whitespace fixes

Change-Id: If4747cb4564ac145a8fa62f8b43b29e2c2ed4e8b
---
M MyVariables.body.php
M MyVariables.i18n.magic.php
M MyVariables.php
3 files changed, 15 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MyVariables 
refs/changes/45/225345/1

diff --git a/MyVariables.body.php b/MyVariables.body.php
index 07524f6..aa5f4a5 100644
--- a/MyVariables.body.php
+++ b/MyVariables.body.php
@@ -31,7 +31,7 @@
         * @param string $ret
         * @return boolean
         */
-       public static function assignAValue(&$parser, &$cache, &$magicWordId, 
&$ret) {
+       public static function assignAValue( &$parser, &$cache, &$magicWordId, 
&$ret ) {
                $parser->disableCache(); # Mark this content as uncacheable
                switch ( $magicWordId ) {
                        case 'MAG_CURRENTLOGGEDUSER':
@@ -50,7 +50,7 @@
                                $ret = $GLOBALS['wgUser']->mRealName;
                                break;
                        case 'MAG_UUID':
-                               $ret = self::get_UUID();
+                               $ret = UIDGenerator::newUUIDv4();
                                break;
                        case 'MAG_USERLANGUAGECODE':
                                $ret = $GLOBALS['wgUser']->getOption( 
'language' );
@@ -60,24 +60,4 @@
                }
                return true;
        }
-
-       /**
-        * Generates version 4 UUID (random)
-        *
-        * @author Ryan McKeel ( Rmckeel )
-        * @return string
-        */
-       public static function get_UUID( ) {
-               if( function_exists('uuid_create') ) {
-                       // create random UUID use PECL uuid extension
-                       return uuid_create();
-               }
-               // Alternate creation method from 
http://aaronsaray.com/blog/2009/01/14/php-and-the-uuid/comment-page-1/#comment-1522
-               // May not be as fast or as accurate to specification as 
php5-uuid
-               return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
-                       mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 
0xffff ),
-                       mt_rand( 0, 0x0fff ) | 0x4000,
-                       mt_rand( 0, 0x3fff ) | 0x8000,
-                       mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 
0xffff ) );
-       }
-}
\ No newline at end of file
+}
diff --git a/MyVariables.i18n.magic.php b/MyVariables.i18n.magic.php
index bfea200..8fc54a3 100644
--- a/MyVariables.i18n.magic.php
+++ b/MyVariables.i18n.magic.php
@@ -15,10 +15,8 @@
 $magicWords['en'] = array(
        'MAG_CURRENTUSER' => array( 0, 'CURRENTUSER' ),
        'MAG_CURRENTLOGGEDUSER' => array( 0, 'CURRENTLOGGEDUSER' ),
-       'MAG_CURRENTUSERREALNAME' => array( 0, 'CURRENTUSERREALNAME'),
-       'MAG_LOGO' => array( 0, 'LOGO'),
-       'MAG_UUID' => array( 0, 'UUID'),
-       'MAG_USERLANGUAGECODE' => array(0, 'USERLANGUAGECODE'),
+       'MAG_CURRENTUSERREALNAME' => array( 0, 'CURRENTUSERREALNAME' ),
+       'MAG_LOGO' => array( 0, 'LOGO' ),
+       'MAG_UUID' => array( 0, 'UUID' ),
+       'MAG_USERLANGUAGECODE' => array( 0, 'USERLANGUAGECODE' ),
 );
-
-
diff --git a/MyVariables.php b/MyVariables.php
index 4387a3f..ab0a9dd 100644
--- a/MyVariables.php
+++ b/MyVariables.php
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * MyVariables - An extension that allows the addition of new built in 
variables
  *
@@ -20,16 +19,17 @@
 
 // Register this extension on Special:Version
 $wgExtensionCredits['parserhook'][] = array(
-       'path'                          => __FILE__,
-       'name'                          => 'MyVariables',
-       'version'                       => '3.2.0',
-       'url'                           => 
'https://www.mediawiki.org/wiki/Extension:MyVariables',
-       'author'                        => array( 
'[https://www.mediawiki.org/wiki/User:Nad Aran Dunkley]', 
'[https://www.mediawiki.org/wiki/User:Pastakhov Pavel Astakhov]', '...',  ),
-       'descriptionmsg'        => 'myvariables-desc'
+       'path' => __FILE__,
+       'name' => 'MyVariables',
+       'version' => '3.3.0',
+       'url' => 'https://www.mediawiki.org/wiki/Extension:MyVariables',
+       'author' => array( '[https://www.mediawiki.org/wiki/User:Nad Aran 
Dunkley]',
+               '[https://www.mediawiki.org/wiki/User:Pastakhov Pavel 
Astakhov]', '...', ),
+       'descriptionmsg' => 'myvariables-desc'
 );
 
 // Tell the whereabouts of files
-$dir = dirname(__FILE__);
+$dir = dirname( __FILE__ );
 
 // Allow translations for this extension
 $wgMessagesDirs['MyVariables'] = __DIR__ . '/i18n';

-- 
To view, visit https://gerrit.wikimedia.org/r/225345
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4747cb4564ac145a8fa62f8b43b29e2c2ed4e8b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MyVariables
Gerrit-Branch: master
Gerrit-Owner: tosfos <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to