mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +01:00
to allow installing api or EGroupware without phpgwapi, old exceptions which we have to extend in order allow old apps to catch exceptions thrown from new api, have to reside in api/inc and get autoloaded
This commit is contained in:
parent
5db786a7ae
commit
834cc466f5
24
api/inc/class.egw_exception_db.inc.php
Normal file
24
api/inc/class.egw_exception_db.inc.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware API - old deprecated exceptions
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package api
|
||||
* @subpackage accounts
|
||||
* @access public
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Exception thrown by the egw_db class for everything not covered by extended classed below
|
||||
*
|
||||
* New Db\Exception has to extend deprecated egw_exception_db to allow legacy code
|
||||
* to catch exceptions thrown by Api\Db class!
|
||||
*
|
||||
* @deprecated use Api\Db\Exception
|
||||
*/
|
||||
class egw_exception_db extends Api\Exception {}
|
24
api/inc/class.egw_exception_db_invalid_sql.inc.php
Normal file
24
api/inc/class.egw_exception_db_invalid_sql.inc.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware API - old deprecated exceptions
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package api
|
||||
* @subpackage accounts
|
||||
* @access public
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Classic invalid SQL error
|
||||
*
|
||||
* New InvalidSql exception has to extend deprecated egw_exception_db_invalid_sql
|
||||
* to allow legacy code to catch exceptions thrown by Api\Db!
|
||||
*
|
||||
* @deprecated use Api\Db\Exception\InvalidSql
|
||||
*/
|
||||
class egw_exception_db_invalid_sql extends Api\Db\Exception {}
|
24
api/inc/class.egw_exception_no_permission.inc.php
Normal file
24
api/inc/class.egw_exception_no_permission.inc.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware API - old deprecated exceptions
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package api
|
||||
* @subpackage accounts
|
||||
* @access public
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Base class for all exceptions about missing permissions
|
||||
*
|
||||
* New NoPermisison excpetion has to extend deprecated egw_exception_no_permission
|
||||
* to allow legacy code to catch them!
|
||||
*
|
||||
* @deprecated use Api\Exception\NoPermission
|
||||
*/
|
||||
class egw_exception_no_permission extends Api\Exception {}
|
@ -148,7 +148,7 @@ class Sql
|
||||
$this->table.'.account_id='.abs($account_id),
|
||||
__LINE__, __FILE__, false, '', false, 0, $join);
|
||||
}
|
||||
catch (egw_exception_db $e) {
|
||||
catch (Api\Db\Exception $e) {
|
||||
unset($e);
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ class Sql
|
||||
}
|
||||
}
|
||||
// ignore not (yet) existing mailaccounts table (does NOT work in PostgreSQL, because of transaction!)
|
||||
catch (egw_exception_db $e) {
|
||||
catch (Api\Db\Exception $e) {
|
||||
unset($e);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class ItemPicker extends Etemplate\Widget
|
||||
* Constructor
|
||||
*
|
||||
* @param string|XMLReader $xml string with xml or XMLReader positioned on the element to construct
|
||||
* @throws egw_exception_wrong_parameter
|
||||
* @throws Api\Exception\WrongParameter
|
||||
*/
|
||||
public function __construct($xml = '')
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ class Select extends Etemplate\Widget
|
||||
* Constructor
|
||||
*
|
||||
* @param string|XMLReader $xml string with xml or XMLReader positioned on the element to construct
|
||||
* @throws egw_exception_wrong_parameter
|
||||
* @throws Api\Exception\WrongParameter
|
||||
*/
|
||||
public function __construct($xml = '')
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ class Taglist extends Etemplate\Widget
|
||||
* Overrides parent to check for $xml first, prevents errors when instanciated without (via AJAX)
|
||||
*
|
||||
* @param string|XMLReader $xml string with xml or XMLReader positioned on the element to construct
|
||||
* @throws egw_exception_wrong_parameter
|
||||
* @throws Api\Exception\WrongParameter
|
||||
*/
|
||||
public function __construct($xml = '')
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ class Textbox extends Etemplate\Widget
|
||||
* Constructor
|
||||
*
|
||||
* @param string|XMLReader $xml string with xml or XMLReader positioned on the element to construct
|
||||
* @throws egw_exception_wrong_parameter
|
||||
* @throws Api\Exception\WrongParameter
|
||||
*/
|
||||
public function __construct($xml)
|
||||
{
|
||||
|
@ -6403,11 +6403,11 @@ class Mail
|
||||
}
|
||||
elseif (is_uploaded_file($_formData['file']))
|
||||
{
|
||||
move_uploaded_file($_formData['file'], $GLOBALS['egw_info']['server']['temp_dir'].SEP.$tmpFileName); // requirement for safe_mode!
|
||||
move_uploaded_file($_formData['file'], $GLOBALS['egw_info']['server']['temp_dir'].'/'.$tmpFileName); // requirement for safe_mode!
|
||||
}
|
||||
else
|
||||
{
|
||||
rename($_formData['file'], $GLOBALS['egw_info']['server']['temp_dir'].SEP.$tmpFileName);
|
||||
rename($_formData['file'], $GLOBALS['egw_info']['server']['temp_dir'].'/'.$tmpFileName);
|
||||
}
|
||||
} else {
|
||||
//error_log("Import of message ".$_formData['file']." failes to meet basic restrictions");
|
||||
@ -6808,7 +6808,7 @@ class Mail
|
||||
$message = Link::get_data(parse_url($tmpFileName, PHP_URL_HOST), true);
|
||||
break;
|
||||
default:
|
||||
$tmpFileName = $GLOBALS['egw_info']['server']['temp_dir'].SEP.basename($tmpFileName);
|
||||
$tmpFileName = $GLOBALS['egw_info']['server']['temp_dir'].'/'.basename($tmpFileName);
|
||||
break;
|
||||
}
|
||||
if (!isset($message)) $message = fopen($tmpFileName, 'r');
|
||||
|
@ -195,7 +195,7 @@ class MimeMagic
|
||||
}
|
||||
|
||||
mt_srand(time());
|
||||
$filename = $GLOBALS['egw_info']['server']['temp_dir'] . SEP
|
||||
$filename = $GLOBALS['egw_info']['server']['temp_dir'] . '/'
|
||||
. md5( time() + mt_rand() ) . '.tmp';
|
||||
|
||||
$fp = @fopen($filename, 'ab');
|
||||
|
@ -385,8 +385,8 @@ class Sharing
|
||||
* @param string $name filename to use for $mode==self::LINK, default basename of $path
|
||||
* @param string|array $recipients one or more recipient email addresses
|
||||
* @param array $extra =array() extra data to store
|
||||
* @throw egw_exception_not_found if $path not found
|
||||
* @throw egw_excpetion_assertion_failed if user temp. directory does not exist and can not be created
|
||||
* @throw Api\Exception\NotFound if $path not found
|
||||
* @throw Api\Exception\AssertionFailed if user temp. directory does not exist and can not be created
|
||||
* @return array with share data, eg. value for key 'share_token'
|
||||
*/
|
||||
public static function create($path, $mode, $name, $recipients, $extra=array())
|
||||
|
@ -69,6 +69,8 @@ spl_autoload_register(function($class)
|
||||
$app = array_shift($components);
|
||||
// classes using the new naming schema app_class_name, eg. admin_cmd
|
||||
if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$class.'.inc.php') ||
|
||||
// compatibility class in new eGW api dir, eg. exceptions
|
||||
file_exists($file = EGW_INCLUDE_ROOT.'/api/inc/class.'.$class.'.inc.php') ||
|
||||
// classes using the new naming schema app_class_name, eg. admin_cmd
|
||||
isset($components[0]) && file_exists($file = EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$app.'_'.$components[0].'.inc.php') ||
|
||||
// classes with an underscore in their name
|
||||
|
@ -90,7 +90,7 @@ function _egw_log_exception($e,&$headline=null)
|
||||
function egw_exception_handler($e)
|
||||
{
|
||||
// handle redirects without logging
|
||||
if (is_a($e, 'egw_exception_redirect'))
|
||||
if ($e instanceof Api\Exception\Redirect)
|
||||
{
|
||||
egw::redirect($e->url, $e->app);
|
||||
}
|
||||
|
@ -26,16 +26,6 @@ use EGroupware\Api;
|
||||
*/
|
||||
class egw_exception extends Api\Exception {}
|
||||
|
||||
/**
|
||||
* Base class for all exceptions about missing permissions
|
||||
*
|
||||
* New NoPermisison excpetion has to extend deprecated egw_exception_no_permission
|
||||
* to allow legacy code to catch them!
|
||||
*
|
||||
* @deprecated use Api\Exception\NoPermission
|
||||
*/
|
||||
class egw_exception_no_permission extends Api\Exception {}
|
||||
|
||||
/**
|
||||
* A record or application entry was not found for the given id
|
||||
*
|
||||
@ -68,26 +58,6 @@ class egw_exception_wrong_parameter extends Api\Exception\WrongParameter {}
|
||||
*/
|
||||
class egw_exception_wrong_userinput extends Api\Exception\WrongUserInput {}
|
||||
|
||||
/**
|
||||
* Exception thrown by the egw_db class for everything not covered by extended classed below
|
||||
*
|
||||
* New Db\Exception has to extend deprecated egw_exception_db to allow legacy code
|
||||
* to catch exceptions thrown by Api\Db class!
|
||||
*
|
||||
* @deprecated use Api\Db\Exception
|
||||
*/
|
||||
class egw_exception_db extends Api\Exception {}
|
||||
|
||||
/**
|
||||
* Classic invalid SQL error
|
||||
*
|
||||
* New InvalidSql exception has to extend deprecated egw_exception_db_invalid_sql
|
||||
* to allow legacy code to catch exceptions thrown by Api\Db!
|
||||
*
|
||||
* @deprecated use Api\Db\Exception\InvalidSql
|
||||
*/
|
||||
class egw_exception_db_invalid_sql extends Api\Db\Exception {}
|
||||
|
||||
/**
|
||||
* Allow callbacks to request a redirect
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user