fix PHP Fatal Class 'EGroupware\Vfs' not found in importexport/inc/class.importexport_schedule_ui.inc.php

thought there's old phpgwapi and eTemplate code in here, which either needs to be removed or fixed
This commit is contained in:
Ralf Becker 2016-05-16 12:18:20 +02:00
parent 9ce24a0822
commit 631c22bdd2

View File

@ -1,6 +1,6 @@
<?php
/**
* eGroupWare
* EGroupware - ImportExport
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package importexport
@ -20,8 +20,8 @@ use EGroupware\Api\Etemplate;
*
*/
class importexport_schedule_ui {
class importexport_schedule_ui
{
public $public_functions = array(
'index' => true,
'edit' => true,
@ -63,10 +63,6 @@ use EGroupware\Api\Etemplate;
$async['data'][$messages] = $list;
}
}
if($results)
{
$async['data']['result'] = $results;
}
if(is_numeric($async['data']['record_count'])) {
$async['data']['record_count'] = lang('%1 records processed', $async['data']['record_count']);
}
@ -83,7 +79,7 @@ use EGroupware\Api\Etemplate;
$this->template->read('importexport.schedule_index');
$GLOBALS['egw_info']['flags']['app_header'] = lang('Schedule import / export');
$this->template->exec('importexport.importexport_schedule_ui.index', $data, $sel_options, $readonlys, $preserve);
$this->template->exec('importexport.importexport_schedule_ui.index', $data, $sel_options);
}
public function edit($content = array()) {
@ -167,7 +163,7 @@ use EGroupware\Api\Etemplate;
$GLOBALS['egw_info']['flags']['app_header'] = lang('Schedule import / export');
$this->template->read('importexport.schedule_edit');
$this->template->exec('importexport.importexport_schedule_ui.edit', $data, $sel_options, $readonlys, $preserve, 2);
$this->template->exec('importexport.importexport_schedule_ui.edit', $data, $sel_options, array(), $preserve, 2);
}
/**
@ -188,7 +184,7 @@ use EGroupware\Api\Etemplate;
$plugins = importexport_helper_functions::get_plugins($data['appname'] ? $data['appname'] : 'all', $data['type']);
if(is_array($plugins)) {
foreach($plugins as $appname => $types) {
foreach($plugins as $types) {
if(!is_array($types[$data['type']])) continue;
foreach($types[$data['type']] as $key => $title) {
$options['plugin'][$key] = $title;
@ -198,10 +194,6 @@ use EGroupware\Api\Etemplate;
$options['definition'] = array();
if($data['file'] && !is_array($data['file'])) {
$extension = substr($data['file'], -3);
}
// If the query isn't started with something, bodefinitions won't load the definitions
$query = array();
$query['type'] = $data['type'];
@ -212,10 +204,11 @@ use EGroupware\Api\Etemplate;
try {
$definition = new importexport_definition($identifier);
} catch (Exception $e) {
unset($e);
// permission error
continue;
}
if ($title = $definition->get_title()) {
if (($title = $definition->get_title())) {
$options['definition'][$title] = $title;
}
unset($definition);
@ -245,6 +238,8 @@ use EGroupware\Api\Etemplate;
* Get plugins via ajax
*/
public function ajax_get_plugins($type, $appname, &$response = null) {
// todo nathan: xajaxResponse needs to be replaced with Api\Json\Response, assign('exec[plugin]' is not eT2, is that code still used?
// please remove of not, or fix it
if($response) {
$return = false;
} else {
@ -274,6 +269,8 @@ use EGroupware\Api\Etemplate;
* Get definitions via ajax
*/
public function ajax_get_definitions($appname, $plugin, &$response = null) {
// todo nathan: xajaxResponse needs to be replaced with Api\Json\Response, assign('exec[plugin]' is not eT2, is that code still used?
// please remove of not, or fix it
$options = self::get_select_options(array('appname'=>$appname, 'plugin'=>$plugin));
if($response) {
$return = false;
@ -308,18 +305,17 @@ use EGroupware\Api\Etemplate;
if($scheme == '' || $scheme == 'file') {
return 'Direct file access not allowed';
}
if($scheme == EGroupware\Vfs::SCHEME && !in_array(EGroupware\Vfs::SCHEME, stream_get_wrappers())) {
stream_wrapper_register(EGroupware\Vfs::SCHEME, 'vfs_stream_wrapper', STREAM_IS_URL);
if($scheme == Vfs::SCHEME && !in_array(Vfs::SCHEME, stream_get_wrappers())) {
stream_wrapper_register(Vfs::SCHEME, 'vfs_stream_wrapper', STREAM_IS_URL);
}
if ($data['type'] == 'import' && ($scheme == EGroupware\Vfs::SCHEME && !Vfs::is_readable($data['target'])))
if ($data['type'] == 'import' && ($scheme == Vfs::SCHEME && !Vfs::is_readable($data['target'])))
{
return lang('%1 is not readable',$data['target']);
}
elseif ($data['type'] == 'import' && in_array($scheme, array('http','https')))
{
// Not supported by is_readable, try headers...
$options = array();
stream_context_set_default(array('http'=>array(
'method' => 'HEAD',
'ignore_errors' => 1
@ -508,7 +504,7 @@ use EGroupware\Api\Etemplate;
$resource = null;
try {
if($resource = @fopen( $target, $data['type'] == 'import' ? 'rb' : 'wb' )) {
if (($resource = @fopen( $target, $data['type'] == 'import' ? 'rb' : 'wb' ))) {
$result = $po->$type( $resource, $definition );
fclose($resource);
@ -601,11 +597,12 @@ use EGroupware\Api\Etemplate;
*/
private static function update_job($data, $no_notification = false) {
$id = self::generate_id($data);
$async = ExecMethod('phpgwapi.asyncservice.read', $id);
$async = $async[$id];
if(is_array($async)) {
ExecMethod('phpgwapi.asyncservice.cancel_timer', $id);
$result = ExecMethod2('phpgwapi.asyncservice.set_timer',
$async = new Api\Asyncservice();
$jobs = $async->read($id);
$job = $jobs[$id];
if(is_array($job)) {
$async->cancel_timer($id);
$result = $async->set_timer(
$async['times'],
$id,
'importexport.importexport_schedule_ui.exec',
@ -649,4 +646,3 @@ use EGroupware\Api\Etemplate;
return $result;
}
}
?>