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