[eGroupWare-svn] r55942 - /trunk/egroupware/doc/fix_api.php

[email protected] Fri, 29 Apr 2016 13:03:04 -0000
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: ralfbecker
Date: Fri Apr 29 15:03:04 2016
New Revision: 55942

URL: http://svn.stylite.de/viewvc/egroupware?rev=55942&view=rev
Log:
latest fix_api addtions

Modified:
    trunk/egroupware/doc/fix_api.php

Modified: trunk/egroupware/doc/fix_api.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/doc/fix_api.php?rev=55942&r1=55941&r2=55942&view=diff
==============================================================================
--- trunk/egroupware/doc/fix_api.php (original)
+++ trunk/egroupware/doc/fix_api.php Fri Apr 29 15:03:04 2016
@@ -18,7 +18,7 @@
 // raw replacements
 $add_use_api = array(
 	"#use EGroupware\\\\Api;\n#" => '',	// remove evtl. use EGroupware\Api, as we add it again below
-	"#<\?php\n/\*\*.*\*/#msU" => "\$0\n\nuse EGroupware\\Api;",
+	"#<\?php\n+\s*/\*+?(.*)\*/#msU" => "<?php\n/**$1*/\n\nuse EGroupware\\Api;",
 );
 $replace = array(
 	'#egw_framework::csp_connect_src_attrs\(#' => "Api\\Header\\ContentSecurityPolicy::add('connect-src', ",
@@ -33,12 +33,15 @@
 	"#\\\$GLOBALS\['egw'\]->hooks->#" => 'Api\\Hooks::',
 	'#Api\\\\Hooks::hook_implemented#' => 'Api\\Hooks::implemented',
 	'#Api\\\\Hooks::hook_exists#' => 'Api\\Hooks::exists',
+	'#Api\\\\Hooks::register_(all_hooks|hooks|single_app_hook)\([^)]*\)#' => 'Api\\Hooks::read(true)',
 	"#\\\$GLOBALS\['egw'\]->translation->#" => 'Api\\Translation::',
+	"#\\\$GLOBALS\['egw'\]->country->#" => 'Api\\Country::',
 	'#egw_framework::csp_script_src_attrs\((.*)\);#' => "Api\\Header\\ContentSecurityPolicy::add('script-src', \$1);",
 	'#egw_framework::csp_style_src_attrs\((.*)\);#' => "Api\\Header\\ContentSecurityPolicy::add('style-src', \$1);",
 	'#egw_framework::csp_connect_src_attrs\((.*)\);#' => "Api\\Header\\ContentSecurityPolicy::add('connect-src', \$1);",
 	'#egw_framework::csp_frame_src_attrs\((.*)\);#' => "Api\\Header\\ContentSecurityPolicy::add('frame-src', \$1);",
 	'#common::show_date\(([^,]+),\s*([^,]+),\s*false\)#' => 'Api\\DateTime::to($1, $2)',
+	"#\\\$GLOBALS\['egw'\]->preferences->change#" => '$GLOBALS[\'egw\']->preferences->add',
 );
 // enclose class-names and static methods with some syntax check
 $class_start = '#(?<!function)([\[\s,;().!])';
@@ -154,6 +157,7 @@
 	'etemplate_widget_vfs' => 'Api\\Etemplate\\Widget\\Vfs',
 	'etemplate_request' => 'Api\\Etemplate\\Request',
 	'nextmatch_widget::category_action' => 'Api\\Etemplate\\Widget\\Nextmatch::category_action',
+	'nextmatch_widget::DEFAULT_MAX_MENU_LENGTH' => 'Api\\Etemplate\\Widget\\Nextmatch::DEFAULT_MAX_MENU_LENGTH',
 	// so_sql and friends
 	'so_sql' => 'Api\\Storage\\Base',
 	'so_sql_cf' => 'Api\\Storage',
@@ -187,12 +191,12 @@
 
 	if (($content = $content_in = file_get_contents($file)) === false) return false;
 
-	if (!preg_match("|<\?php\n/\*\*.*\*/|msU", $content))
+	if (!preg_match("|<\?php\n+\s*/\*\*?.*\*/|msU", $content))
 	{
 		error_log("No file-level phpDoc block found in $file to add 'use EGroupware\\Api;'\n");
 		return;
 	}
-	$content2 = 	preg_replace(array_keys($replace), array_values($replace), $content);
+	$content2 = preg_replace(array_keys($replace), array_values($replace), $content);
 
 	if ($content2 == $content_in) return true;	// nothing changed
 
@@ -268,7 +272,7 @@
 function usage($error=null)
 {
 	global $prog;
-	echo "Usage: $prog [-h|--help] [-d|--dry-run] file or dir\n\n";
+	echo "Usage: $prog [-h|--help] [-d|--dry-run] file(s) or dir(s)\n\n";
 	if ($error) echo $error."\n\n";
 	exit($error ? 1 : 0);
 }
@@ -279,7 +283,7 @@
 if (!$args) usage();
 
 $dry_run = false;
-while(($arg = array_shift($args)))
+while(($arg = array_shift($args)) && $arg[0] == '-')
 {
 	switch($arg)
 	{
@@ -302,13 +306,16 @@
 	}
 }
 
-if (!file_exists($arg)) usage("Error: $arg not found!");
-
-if (!is_dir($arg))
-{
-	fix_api($arg, $dry_run);
-}
-else
-{
-	fix_api_recursive($arg, $dry_run);
-}
+do {
+	if (!file_exists($arg)) usage("Error: $arg not found!");
+
+	if (!is_dir($arg))
+	{
+		fix_api($arg, $dry_run);
+	}
+	else
+	{
+		fix_api_recursive($arg, $dry_run);
+	}
+}
+while(($arg = array_shift($args)));


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z