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

[email protected]
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: ralfbecker
Date: Tue Apr 26 20:27:51 2016
New Revision: 55863

URL: http://svn.stylite.de/viewvc/egroupware?rev=55863&view=rev
Log:
latest changed used to update timesheet

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=55863&r1=55862&r2=55863&view=diff
==============================================================================
--- trunk/egroupware/doc/fix_api.php (original)
+++ trunk/egroupware/doc/fix_api.php Tue Apr 26 20:27:51 2016
@@ -30,14 +30,16 @@
 	"#\\\$GLOBALS\['egw'\]->common->#" => 'common::',
 	"#\\\$GLOBALS\['egw'\]->hooks->#" => 'Api\\Hooks::',
 	'#Api\\Hooks::hook_implemented#' => 'Api\\Hooks::implemented',
+	'#Api\\Hooks::hook_exists#' => 'Api\\Hooks::exists',
 	"#\\\$GLOBALS\['egw'\]->translation->#" => 'Api\\Translation::',
 	'#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)',
 );
 // enclose class-names and static methods with some syntax check
-$class_start = '#([\[\s,;(.!])';
+$class_start = '#(?<!function)([\[\s,;(.!])';
 $class_end = '(::|\\(|\\)|;|\?|:|\\s|,|$)#';
 foreach(array(
 	'accounts' => 'Api\\Accounts',
@@ -51,7 +53,7 @@
 	'EGW_ACL_CUSTOM_1' => 'Api\\Acl::CUSTOM1',
 	'EGW_ACL_CUSTOM_2' => 'Api\\Acl::CUSTOM2',
 	'EGW_ACL_CUSTOM_3' => 'Api\\Acl::CUSTOM3',
-	//'applications' => 'Api\\Applications',
+	'applications' => 'Api\\Applications',
 	'asyncservice' => 'Api\\AsyncService',
 	'auth' => 'Api\\Auth',
 	'categories' => 'Api\\Categories',
@@ -74,8 +76,12 @@
 	'common::email_address' => 'Api\\Accounts::email',
 	'common::next_id' => 'Api\\Accounts\\Ldap::next_id',
 	'common::last_id' => 'Api\\Accounts\\Ldap::last_id',
+	'common::egw_header' => "\$GLOBALS['egw']->framework->header",
+	'common::egw_footer' => "\$GLOBALS['egw']->framework->footer",
+	'common::show_date' => 'Api\\DateTime::server2user',
 	'country' => 'Api\\Country',
-	//'egw' =>
+	'egw' => 'Api\\Egw',
+	'egw_minimal' => 'Api\\Egw\\Base',
 	'egw_cache' => 'Api\\Cache',
 	'egw_ckeditor_config' => 'Api\\Html\\CkEditorConfig',
 	'egw_customfields' => 'Api\\Storage\\Customfields',
@@ -158,6 +164,10 @@
 {
 	$replace[$class_start.$from.$class_end] = '$1'.$to.'$2';
 }
+// raw expressions running after regular replacements, because they would be replaced themself if running before
+$replace += array(
+	"#\\\$GLOBALS\['egw'\]->js->#" => 'egw_framework::',
+);
 //print_r($replace);
 
 /**
@@ -182,7 +192,7 @@
 	$content = 	preg_replace(array_keys($replace), array_values($replace), $content);
 
 	// shorten some classes, if used, with further use declarations
-	foreach(array('Api\\Etemplate', 'Api\\Vfs') as $namespace)
+	foreach(array('Api\\Etemplate', 'Api\\Vfs', 'Api\\Acl', 'Api\\Egw', 'Api\\Framework', 'Api\\Link') as $namespace)
 	{
 		if (strpos($content, $namespace) !== false && strpos($content, 'use EGroupware\\'.$namespace) === false)
 		{
@@ -199,7 +209,16 @@
 	}
 	elseif ($content_in != $content)
 	{
-		file_put_contents($file, $content);
+		file_put_contents($file.'.new', $content);
+		$ret = 0;
+		system('/usr/bin/php -l '.$file.'.new', $ret);
+		system('/usr/bin/diff -u '.$file.' '.$file.'.new');
+		if (!$ret)
+		{
+			unlink($file);
+			rename($file.'.new', $file);
+		}
+		return !$ret;
 	}
 
 	return true;


------------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.