r13605 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13604‎ | r13605 | r13606 >
Date:08:32, 12 April 2006
Author:brion
Status:old
Tags:
Comment:
* PersistentObject removed; it doesn't do anything and was broken besides.
All extensions using it have been corrected.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/PersistentObject.php (deleted) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/PersistentObject.php
@@ -1,50 +0,0 @@
2 -<?php
3 -/**
4 - * Sometimes one wants to make an extension that defines a class that one wants
5 - * to backreference somewhere else in the code, doing something like:
6 - * <code>
7 - * class Extension { ... }
8 - * function myExtension() { new Extension; }
9 - * </class>
10 - *
11 - * Won't work because PHP will destroy any reference to the initialized
12 - * extension when the function goes out of scope, furthermore one might want to
13 - * use some functions in the Extension class that won't exist by the time
14 - * extensions get parsed which would mean lots of nasty workarounds to get
15 - * around initialization and reference issues.
16 - *
17 - * This class allows one to write hir extension as:
18 - *
19 - * <code>
20 - * function myExtension() {
21 - * class Extension { ... }
22 - * new PersistentObject( new Extension );
23 - * }
24 - * </code>
25 - *
26 - * The class will then not get parsed until everything is properly initialized
27 - * and references to it won't get destroyed meaning that it's possible to do
28 - * something like:
29 - *
30 - * <code>
31 - * $wgParser->setHook( 'tag' , array( &$this, 'tagFunc' ) );
32 - * </code>
33 - *
34 - * And have it work as expected
35 - *
36 - * @package MediaWiki
37 - * @subpackage Extensions
38 - *
39 - * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
40 - * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
41 - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
42 - */
43 -
44 -$wgPersistentObjects = array();
45 -
46 -class PersistentObject {
47 - function PersistentObject( &$obj ) {
48 - $wgPersistentObjects[] = $obj;
49 - }
50 -}
51 -?>
Index: trunk/phase3/includes/Setup.php
@@ -203,10 +203,6 @@
204204 # Entries can be added to this variable during the inclusion
205205 # of the extension file. Skins can then perform any necessary initialisation.
206206 #
207 -# require_once is slow even on the second call, so this needs to be outside the loop
208 -if ( count( $wgSkinExtensionFunctions ) ) {
209 - require_once( 'PersistentObject.php' );
210 -}
211207 foreach ( $wgSkinExtensionFunctions as $func ) {
212208 call_user_func( $func );
213209 }
@@ -320,9 +316,6 @@
321317 # Entries should be added to this variable during the inclusion
322318 # of the extension file. This allows the extension to perform
323319 # any necessary initialisation in the fully initialised environment
324 -if ( count( $wgExtensionFunctions ) ) {
325 - require_once( 'PersistentObject.php' );
326 -}
327320 foreach ( $wgExtensionFunctions as $func ) {
328321 call_user_func( $func );
329322 }
Index: trunk/phase3/RELEASE-NOTES
@@ -53,6 +53,8 @@
5454 * Don't force edit summaries when a user is editing their own user/talk page
5555 * (bug 5510) Warning produced when using {{SUBPAGENAME}} in some namespaces
5656 * (bug 385) Installer support for PostgreSQL, fixes for PG compatibility
 57+* PersistentObject removed; it doesn't do anything and was broken besides.
 58+ All extensions using it have been corrected.
5759
5860
5961 == Compatibility ==

Status & tagging log