Extension talk:PageCreator/Flow

About this board

Migrate code to Gerrit or Gitlab

2
P858snake (talkcontribs)

Hey @Pierro78 & @Seb35,

It looks like the code for this extension is still being maintained, Have you considered moving it over to Gerrit or Gitlab?

Seb35 (talkcontribs)

It’s funny, I didn’t remember I was written as an author on this extension :) When I did maintenance on it for 1.35 (diff), I noted these magic words were included in Extension:MyVariables. The code for {{PAGECREATOR}} and {{CREATIONTIMESTAMP}} here is exactly the same as for {{FIRSTREVISIONUSER}} and {{FIRSTREVISIONTIMESTAMP}} in MyVariables.

Instead of maintaining one more extension on Gerrit/Gitlab, I think a better alternative is delete this extension and redirect the users to Extension:MyVariables (which is a light extension, not much heavier and more complex extension compared to this one). The only small difficulty for users would be to upgrade the variables: it can be done with Extension:ReplaceText.

Reply to "Migrate code to Gerrit or Gitlab"

Compatibility with 1.33?

1
.digamma (talkcontribs)

I just tried this on my wiki and encountered a blank page when I loaded the Special:Version page. Also, the require once invocation calls the PageCreator.php file but the code indicates it should be stored in a GetPageCreator.php. Which name do I give the php file? Does it auto-prepend the 'Get' to the name of the file? When I gave it the name, GetPageCreator.php, I ended up with a PHP stack trace with message: index.php?title=Special:SpecialPages   MWException from line 187 of /public_html/w/includes/MagicWord.php: Error: invalid magic word 'PAGECREATOR'

Reply to "Compatibility with 1.33?"

Add Option to get PAGECREATOR for any page

1
Pvodrazka (talkcontribs)

Is it possible to add a feature like:


 {{PAGECREATOR|Page=SomePage}}
 

This would be useful with DPL. Thanks.

Reply to "Add Option to get PAGECREATOR for any page"
Rudloff (talkcontribs)
Reply to "Fork"

pagecreator returns the last editor's username

1
185.31.48.30 (talkcontribs)

why is this?

Reply to "pagecreator returns the last editor's username"

Patch to obtain real name of user

1
Teokraba (talkcontribs)

I'm running Mediawiki (now 1.20.x) with PageCreator 0.3, LdapAuthentication + RealNames extension in a big ICT Company. All users log in into wiki with their own & unique company ID .The real name of each one is located on realname field of LDAP server and the real name can be show with RealNames extension, because It was developed mainly for Enterprise/Corporate users of MediaWiki where realnames are much more important, and often make much more sense than algorithmically chosen usernames.

For example: login as ABC12345 and the real name is John Doe, the realname display after log in is: John Doe [ABC12345]

Now, I've write a small (and with really bad code...) patch to obtain a new variable {{CREATORREALNAME}} who return the real name of user:

--- GetPageCreator.php_orig	2013-03-28 12:41:30.000000000 +0100
+++ GetPageCreator.php	2013-03-28 15:01:42.000000000 +0100
@@ -11,9 +11,9 @@
  */
 define( 'PPP_PAGECREATOR', 'PAGECREATOR' );
 define( 'PPP_CREATIONTIMESTAMP', 'CREATIONTIMESTAMP' );
- 
- 
- 
+define( 'PPP_PAGEREVISIONUSER', 'PAGEREVISIONUSER' );
+define( 'PPP_CREATORREALNAME', 'CREATORREALNAME' ); 
+
 /**
  * Step 2: define some words to use in wiki markup
  */
@@ -24,8 +24,8 @@
         // magic ID 'mycustomvar1' (0 means case-insensitive)
         $magicWords[PPP_PAGECREATOR] = array( 0, PPP_PAGECREATOR);
         $magicWords[PPP_CREATIONTIMESTAMP] = array( 0, PPP_CREATIONTIMESTAMP);
- 
-        // must do this or you will silence every LanguageGetMagic hook after this!
+        $magicWords[PPP_CREATORREALNAME] = array( 0, PPP_CREATORREALNAME);
+	// must do this or you will silence every LanguageGetMagic hook after this!
         return true;
 }
  
@@ -71,12 +71,9 @@
                 }
         }
  
- 
- 
- 
-        if ( PPP_CREATIONTIMESTAMP == $magicWordId ) {
+        if ( PPP_PAGECREATOR == $magicWordId ) {
                         global $wgUser;
-                        $revuser = $wgUser->getName();
+                        $revuser = $wgUser->getRealName();
  
                 $ret = $revuser;
 
@@ -96,11 +93,11 @@
                 $revTable = $dbr->tableName( 'revision' );
  
                 $pageId = $myArticle->getId();
-                $q0 = "select rev_timestamp from ".$revTable." where rev_page=".$pageId." order by rev_timestamp asc limit 1";
+                $q0 = "select rev_user_text from ".$revTable." where rev_page=".$pageId." order by rev_timestamp asc limit 1";
                 if(($res0 = mysql_query($q0)) && ($row0 = mysql_fetch_object($res0)))
                {
-                  $ret=$row0->rev_timestamp;
-//$ret='coucou';
+                  $ret=$row0->rev_user_text;
+// $ret= $magicWordId ;
                 }
                 else
                 {
@@ -109,10 +106,17 @@
                   $articleId=$myTitle->getArticleID();
 //                $ret="pageId:".$pageId."-arcticleId:".$articleId."-getText:".$myTitle->getText()."-getFullText:".$myTitle->getFullText();
                 }
+        } 
+
+// get the real name of user and return it
+        if ( PPP_CREATORREALNAME == $magicWordId ) {
+                        global $wgUser;
+                        $revuser = $wgUser->getRealName();
+                $ret = $revuser; 
         }
- 
- 
- 
+
+
+
  
         // We must return true for two separate reasons:
         // 1. To permit further callbacks to run for this hook.
@@ -152,7 +156,7 @@
         // variable IDs. We oblige by adding ours:
         $customVariableIds[] = PPP_PAGECREATOR;
         $customVariableIds[] = PPP_CREATIONTIMESTAMP;
- 
+	$customVariableIds[] = PPP_CREATORREALNAME; 
         // must do this or you will silence every MagicWordwgVariableIds hook
         // registered after this!
        return true; 


Usage example: {{PAGECREATOR}} == {{CREATORREALNAME}} return ABC12345 == John Doe

It' simple but it's useful!

Reply to "Patch to obtain real name of user"

more readable timestamp

1
219.142.53.236 (talkcontribs)
$q0 = "select rev_timestamp from ".$revTable." where rev_page=".$pageId." order by rev_timestamp asc limit 1";
                if(($res0 = mysql_query($q0)) && ($row0 = mysql_fetch_object($res0)))
                {
                  $timestamp=$row0->rev_timestamp;
                  //add this line to make the timestap more readable
                  $ret = $wgLang->timeanddate( wfTimestamp(TS_MW, $timestamp), true );
//$ret='coucou';
                }
Reply to "more readable timestamp"
There are no older topics
Return to "PageCreator/Flow" page.