Commit graph

52 commits

Author SHA1 Message Date
MaxSem
e97180e5f6 Revert "Make eval.php try to handle newlines in code"
Completely broke the script for me.

<TimStarling> MaxSem: that was a pretty crazy change
<TimStarling> fancy trying to detect the end of a statement by shelling out to detect parse errors
<TimStarling> maybe just revert that?
<TimStarling> we can probably do a better job with a few regexes
<TimStarling> I wonder how php -a does it

This reverts commit f0ae292da7.

Change-Id: I16c9c200dc3f4db55cecc23aaa0d9ff55504c19d
2015-02-23 00:59:24 +00:00
Aaron Schulz
f0ae292da7 Make eval.php try to handle newlines in code
Change-Id: I9f4664bde6bea6f0e1dca0f4623553b9e849c83b
2015-02-12 08:24:53 +00:00
Chad Horohoe
6d19ca422f Remove $wgDebugFunctionEntry, unused
Change-Id: I5f215ab2275333b329406ca7dda7b12fc0b9b6ec
2015-01-07 21:07:24 -08:00
Alexandre Emsenhuber
d50b4371a5 Fix incorrect replacement inside regular expression
Fix for Id3aa87cfa0 (2537ca2).

The "$" is for the end of the string, not for a variable.

Change-Id: I2d262582644b903992dc621079ea5a6a04d7af70
2014-10-20 10:26:49 +02:00
Tim Starling
2537ca28e9 Use prefixed globals in eval.php main loop
Use globals with less-common names so that variables created by the
command line are less likely to conflict with the ones used by the
eval.php loop.

Change-Id: Id3aa87cfa039eb7555f44e17134c7cdbb5f25cc1
2014-10-20 07:58:32 +00:00
Aaron Schulz
6d3c8ee0d3 Make it a bit safer to paste input to eval.php
Change-Id: I0839678e3dec64a709c0fe8808329268f36486d2
2014-01-09 15:04:51 -08:00
Tim Starling
e5d0ca5eaf eval.php: update intro comment
PHP has had an interactive mode since 5.1.0.

Change-Id: I5ecc35ca6c4911b4fbc8eb17866997d931c5a97d
2013-12-17 14:39:53 +11:00
Chad Horohoe
22dca6484f Rename wfIsHipHop() to wfIsHHVM()
The former is only really used to refer to the older hphp compiler.
Now all docs pretty much exclusively are referring to HHVM and
that's the project's name going forward.

While we're here, swap HPHP_VERSION for HHVM_VERSION. Either work,
but the latter is more correct.

Only affected extension (in Git or SVN) is GWToolset, fixing in
I3a490ef.

Change-Id: I81e4ce5d14e344e67045050261f91b3c0159f222
2013-10-29 15:36:10 -07:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
Antoine Musso
f6b92231fd style: normalize end of files
By PSR2 PHP Standard, the files should ends with exactly one newline.
Some of our files have 2 or more and some other were missing a newline.

Fix almost all occurences of CodeSniffer sniff:
PSR2.Files.EndFileNewline.TooMany

I have not fixed the selenium files, I believe we will drop them.

Change-Id: I89fca8c1786fee94855b7b77bb0f364001ee84b6
2013-02-03 15:04:39 +01:00
umherirrender
85d8ee1f87 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
2012-10-10 20:14:40 +02:00
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
Chad Horohoe
268edfd9e4 Revert r108777 (making eval subclass maintenance). eval's supposed to be in the global context. See r54839 2012-01-14 22:21:30 +00:00
Sam Reed
a528b8ba92 Maintenance class-ify eval.php 2012-01-12 23:10:22 +00:00
Sam Reed
2587017c33 Fix typo in SpecialVersion
Change require to require_once in commandLine.inc

Make eval.php require an absolute path rather than just one in itself

Simplify if statement
2012-01-12 22:14:56 +00:00
Brion Vibber
7f17b26240 Revert r107054: breaks execution of lines that might test or output '<?php' say when generating a PHP script
Is apparently meant to strip an initial line from PHP script files being piped in, but is insufficient to actually catch all cases.
2012-01-03 22:29:32 +00:00
Max Semenik
591e6d1a24 Fixed a typo in r107054 2011-12-22 11:11:59 +00:00
Antoine Musso
6c0efb8ba6 do not evaluate '<?php' line
This happen when you are sending to eval.php a php file. The first line
is the string '<?php' which is passed to eval(). Boom!
This patch skip that string.

Example usage:
 $ cat somefile.php
 <?php
 echo "Working!\n";
 $

 $ cat somefile.php | php maintenance/eval.php
 Working!
 $
2011-12-22 11:06:23 +00:00
Aaron Schulz
8568568191 Removed $wgUseNormalUser var; not used by any scripts anymore 2011-10-28 01:16:18 +00:00
Chad Horohoe
59cfbd0cf9 (bug 30172) posix_isatty() fallback does not work when the function has been disabled (but exists). While we're at it, make things work for HipHop too. 2011-08-02 22:01:58 +00:00
Sam Reed
cdf75379c9 Apply LoadBalancer related fixes
Patches by Yuvi Panda

From (bug 28583) Remove all /* private */ declarations in MediaWiki core
2011-04-18 23:12:58 +00:00
Tim Starling
7bb50c630a The beginnings of HipHop compiled mode support. It works now for parser cache hits.
* Work around HipHop issue 314 (volatile broken) and issue 308 (no compilation detection) by adding some large and ugly compilation detection code to WebStart.php and doMaintenance.php.
* Provide an MW_COMPILED constant which can be used to detect compiled mode throughout the codebase.
* Introduced wfIsHipHop(), which detects either compiled or interpreted mode. Used this to work around unusual eval() return value in eval.php.
* Work around lack of ini_get() in Maintenance.php, by duplicating wfIsHipHop(). 
* In Maintenance::shouldExecute(), accept "include" as an inclusion function name, since all kinds of inclusion give this string in HipHop.
* Introduced new class MWInit, which provides some static functions in the pre-autoloader environment.
* Introduced MWInit::compiledPath(), which provides a relative path for invoking a compiled file, and MWInit::interpretedPath(), which provides an absolute path for interpreting a PHP file. Used these new functions in the appropriate places.
* When we are running compiled code, don't include files which would generate duplicate class, function or constant definitions. Documented the new requirements on the contents of Defines.php and UtfNormalDefines.php.
* In HipHop compiled mode, it's not possible to have executable code in the same file as a class definition. 
  ** Moved MimeMagic initialisation to the constructor.
  ** Moved Namespace.php global variable initialisation to Setup.php.
  ** Moved MemcachedSessions.php initialisation to the caller in GlobalFunctions.php.
  ** Moved Sanitizer.php constants and global variables to static class members. Introduced an accessor function for the attribs regex, as a new place to put code formerly at file level. 
  ** Moved Language.php initialisation of $wgLanguageNames to Language::getLanguageNames(). Removed the global variable, marked "private" since forever.

* In two places: don't use error_log() with type=3 to append to a file, HipHop doesn't support it. Use file_put_contents() with FILE_APPEND instead.
* Work around the terrible breakage of class_exists() by using MWInit::classExists() instead in various places. In WebInstaller::getPageByName(), the class_exists() was marked with a fixme comment already, so I replaced it with an autoloader solution.
2011-04-04 12:59:55 +00:00
Alexandre Emsenhuber
9f5d06527c Part of bug 26280: added license headers to PHP files in maintenance 2010-12-16 19:15:12 +00:00
Chad Horohoe
670602f082 Trying to kill install-utils.inc/old install crap:
* Cripple the old installer (entry point is gone, supporting code immediately exits). Keeping the latter for reference still :)
* Move posix_isatty() wrapper to Maintenance.php, all CLI scripts include this
* Clarify docs on archive() deprecation and removal - hasn't been used going back thru 1.15
* Clarify docs on dbsource() deprecation and removal - was in wide use thru 1.15. 1.16 removed all extension usages
* Move the two PHP bug tests to a file with the other installer files, moved them to more logical places in new install/update sequence
* Remove mw_have_dl/mw_get_session_save_path, zero callers
* Move readconsole() and helpers to be a static method on Maintenance, no extensions have used it since 1.15 either
2010-11-06 22:16:19 +00:00
Chad Horohoe
a41c92b7dd Followup r72108, put the history file in $IP/maintenance rather than the cwd. Also add it to svnignore. 2010-09-03 14:24:40 +00:00
Chad Horohoe
fdfcfd5694 $_ENV['HOME'] might not exist for everyone, doesn't on OSX 2010-09-01 14:30:47 +00:00
Sam Reed
659778619c Stylize maintenance folder.. 2010-05-22 16:50:39 +00:00
Platonides
084e5c30c3 Define our own posix_isatty if posix extension is not installed.
Removes the extension dependency on non-windows for parserTests.
Currently used on install-utils.inc readconsole(), eval.php and parserTests.inc

Maintenance scripts receive it via commandLine.inc -> Maintenance.php .. doMaintenance.php -> install-utils.inc
2010-04-11 15:44:28 +00:00
Tim Starling
b475e93064 Revert eval.php changes from r54653, r54312, r54225 (maintenance-work branch merge), these changes totally broke eval.php due to the change in scope, from global to function. 2009-08-12 03:44:06 +00:00
Chad Horohoe
054fa2cc5d Move $wgUseNormalUser setting to constructors. 2009-08-09 12:26:11 +00:00
Chad Horohoe
567f244e36 Revert r54244 which was stupid and fix this properly. Require commandLine.inc/Maintenance.php using the full path every time. 2009-08-03 21:56:41 +00:00
Chad Horohoe
a1c51e18af Merge maintenance-work branch (now with less errors!):
* Docs have been updated to indicate the standard on how to write maintenance scripts (MW.org docs will follow) Have ported vast majority of maintenance scripts to new format. Remaining ones (mostly FiveUpgrade-related) are a bit more tricky. commandLine.inc is untouched for now. Many have gotten code-style updates as well. Deleted .inc files were only used by their .php counterparts, and have been merged into single files.
* (bug 11867) Lock error on redirect table when running orphans.php
* (bug 16322) Allow maintenance scripts to accept DB user/pass over input or params
* (bug 18566) Maintenance script to un/protect pages
* initStats overhaul, now uses class SiteStatsInit. Also fixes bug 18930
2009-08-02 19:35:17 +00:00
Brion Vibber
1c9773bd01 Revert r52336 "Merge maintenance-work branch:"
Seems to have broken a bunch of stuff. Don't commit giant non-critical changes that break Setup.php and all maint scripts. Thanks!
2009-06-24 02:49:24 +00:00
Chad Horohoe
59b60fc311 Merge maintenance-work branch:
* (bug 16322) Allow maint scripts to accept DB user/pass over input or params if no AdminSettings.php
* (bug 18768) Remove AdminSettings.php from MediaWiki core
* (bug 19157) createAndPromote error on bad password
* (bug 14201) Create AdminSettings.php during wiki installation, in the same way as LocalSettings.php
* Introduce new Maintenance class framework and port a good number of scripts over; the ones that are left are a little more complicated. Read the docs.
* Not deleting "unused" files yet, don't want to break everything at once :)
2009-06-24 02:02:37 +00:00
Tim Starling
640c1d3981 Use a history file with readline, so that readline history is carried over from one invocation to another 2008-07-22 21:47:53 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Alexandre Emsenhuber
2f41e3c98b Removed usage of deprecated settings 2008-04-06 16:14:04 +00:00
Tim Starling
fbfb509df5 * Introduced LBFactory -- an abstract class for configuring database load balancers and connecting to foreign DBs.
* Wrote two concrete implementations. LBFactory_Simple is for general installations. LBFactory_Multi will replace the runtime configuration used on Wikimedia and allow load-balanced connections to any DB. 
* Ported Special:Userrights, CentralAuth and OAI audit to the LBFactory system. 
* Added ForeignDBViaLBRepo, a file repository which uses LBFactory.
* Removed $wgLoadBalancer and $wgAlternateMaster
* Improved the query group concept to allow failover and lag control
* Improved getReaderIndex(), it will now try all servers before waiting, instead of waiting after each.
* Removed the $fail parameter to getConnection(), obsolete. 
* Removed the useless force() function. 
* Abstracted the replication position interface to allow for future non-MySQL support.
* Rearranged Database.php. Added a few debugging features. 
* Removed ancient benet-specific hack from waitForSlave.php
2008-03-30 09:48:15 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Antoine Musso
c771fc9c96 Use Doxygen @addtogroup instead of phpdoc @package && @subpackage 2007-01-20 15:09:52 +00:00
Brion Vibber
6fae318406 Remove some stray executable bits 2006-04-04 07:57:48 +00:00
Ævar Arnfjörð Bjarmason
7bbe971aec * s~ +$~~ 2006-01-07 13:09:30 +00:00
Brion Vibber
219094eb01 Committing various live hacks from Wikimedia servers 2005-10-22 20:52:30 +00:00
Ævar Arnfjörð Bjarmason
349dcf89c8 * Code cleanup 2005-08-29 16:41:24 +00:00
Tim Starling
758e7521ed respect MW_WIKIUSER environment variable 2005-06-19 01:39:16 +00:00
Tim Starling
cdb3f96ab8 Various live patches ported from REL1_4 2005-04-12 04:03:21 +00:00
Brion Vibber
db6c4af271 Spiff this up a bit:
* output data returned by the eval; prints strings and numbers directly, var_dump()s arrays and objects
* if no returned data, print a line break. This makes things easier when doing 'echo' and you forget to add one yourself.
* Add some documentation comments
2004-11-15 00:15:58 +00:00
Antoine Musso
6bbcf091bf Phpdoc comments and place holder. Part of the subpackage "maintenance", archives in subpackage "maintenanceArchive" 2004-09-03 20:33:01 +00:00
Tim Starling
f48ddd1366 using new commandLine.inc style, readconsole() moved to install-utils() 2004-06-13 04:36:53 +00:00
Tim Starling
a1fd103a38 minor improvement 2004-06-12 12:59:45 +00:00