public function get_app_by_alias($alias) { try { $app = $this->get_workbench()->get_app($alias); } catch (AppNotFoundError $e) { $workbench = $this->get_workbench(); $name_resolver = NameResolver::create_from_string($alias, NameResolver::OBJECT_TYPE_APP, $workbench); $this->get_app()->create_app_folder($name_resolver); $app = $this->get_workbench()->get_app($alias); } return $app; }
protected function perform() { $exface = $this->get_workbench(); $installed_counter = 0; foreach ($this->get_target_app_aliases() as $app_alias) { $this->add_result_message("Uninstalling " . $app_alias . "...\n"); $app_name_resolver = NameResolver::create_from_string($app_alias, NameResolver::OBJECT_TYPE_APP, $exface); try { $installed_counter++; $this->uninstall($app_name_resolver); } catch (\Exception $e) { $installed_counter--; // FIXME Log the error somehow instead of throwing it. Otherwise the user will not know, which apps actually installed OK! throw $e; } $this->add_result_message($app_alias . " successfully uninstalled.\n"); } // Save the result and output a message for the user $this->set_result(''); return; }
protected function perform() { $apps = $this->get_input_apps_data_sheet(); $exported_counter = 0; foreach ($apps->get_rows() as $row) { try { $app = $this->get_workbench()->get_app($row['ALIAS']); } catch (AppNotFoundError $e) { $workbench = $this->get_workbench(); $name_resolver = NameResolver::create_from_string($row['ALIAS'], NameResolver::OBJECT_TYPE_APP, $workbench); $this->get_app()->create_app_folder($name_resolver); $app = $this->get_workbench()->get_app($row['ALIAS']); } $this->export_model($app); $exported_counter++; } // Save the result and output a message for the user $this->set_result(''); $this->set_result_message('Exported model files for ' . $exported_counter . ' apps to app-folders in "' . $this->get_export_to_path_relative() . '".'); return; }
public function uninstall_app($app_alias) { $result = ''; try { $exface = $this->get_workbench(); $app_name_resolver = NameResolver::create_from_string($app_alias, NameResolver::OBJECT_TYPE_APP, $exface); $result = $exface->get_app(self::PACKAGE_MANAGER_APP_ALIAS)->get_action(self::PACKAGE_MANAGER_UNINSTALL_ACTION_ALIAS)->uninstall($app_name_resolver); $exface->stop(); } catch (\Exception $e) { $result = $e->getMessage(); } return $result; }