public static function init($prefs_) { Logger::debug('main', 'SharedFolderDB::internal::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $SharedFolder_table_structure = array('id' => 'varchar(255)', 'name' => 'varchar(255)', 'server' => 'varchar(255)', 'status' => 'varchar(255)'); $ret = $SQL->buildTable($sql_conf['prefix'] . SharedFolderDB_internal::$table, $SharedFolder_table_structure, array('id')); Logger::debug('main', "SharedFolderDB::internal::init SQL table '" . $sql_conf['prefix'] . SharedFolderDB_internal::$table . "' created"); return true; }
public static function init($prefs_) { Logger::debug('main', 'ProfileDB::internal::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $Profile_table_structure = array('id' => 'varchar(255)'); $ret = $SQL->buildTable(self::$table, $Profile_table_structure, array('id')); Logger::debug('main', "ProfileDB::internal::init SQL table '" . self::$table . "' created"); return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_ReportServer::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $servers_history_table_structure = array('fqdn' => 'VARCHAR(255) NOT NULL', 'external_name' => 'VARCHAR(255) NOT NULL', 'timestamp' => 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP', 'cpu' => 'FLOAT NOT NULL', 'ram' => 'FLOAT NOT NULL', 'data' => 'LONGTEXT NOT NULL'); $ret = $SQL->buildTable($sql_conf['prefix'] . 'servers_history', $servers_history_table_structure, array()); if (!$ret) { Logger::error('main', 'Unable to create SQL table \'' . $sql_conf['prefix'] . 'servers_history\''); return false; } return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_ReportSession::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $sessions_history_table_structure = array('id' => 'VARCHAR(255) NOT NULL', 'start_stamp' => 'TIMESTAMP NOT NULL default CURRENT_TIMESTAMP', 'stop_stamp' => 'TIMESTAMP NULL default NULL', 'stop_why' => 'VARCHAR(16) default NULL', 'user' => 'VARCHAR(255) NOT NULL', 'server' => 'VARCHAR(255) NOT NULL', 'data' => 'LONGTEXT NOT NULL'); $ret = $SQL->buildTable(self::table, $sessions_history_table_structure, array('id')); if (!$ret) { Logger::error('main', 'Unable to create SQL table \'' . self::table . '\''); return false; } return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_UserGroup_Rule::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $usergroup_rules_table_structure = array('id' => 'int(8) NOT NULL auto_increment', 'attribute' => 'varchar(255)', 'type' => 'varchar(255)', 'value' => 'varchar(255)', 'usergroup_id' => 'varchar(255)'); $ret = $SQL->buildTable(self::table, $usergroup_rules_table_structure, array('id')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . self::table . '\''); return false; } Logger::debug('main', 'MySQL table \'' . self::table . '\' created'); return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_AdminAction::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $tokens_table_structure = array('when' => 'timestamp NOT NULL default CURRENT_TIMESTAMP', 'what' => 'varchar(255) NOT NULL', 'who' => 'varchar(255) NOT NULL', 'where' => 'varchar(255) NOT NULL', 'infos' => 'text'); $ret = $SQL->buildTable(self::table, $tokens_table_structure, array(), array(), 'ARCHIVE'); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . self::table . '\''); return false; } Logger::debug('main', 'MySQL table \'' . self::table . '\' created'); return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_VDI::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $vdi_table_structure = array('id' => 'varchar(64)', 'type' => 'varchar(255)', 'name' => 'varchar(255)', 'server' => 'varchar(255)', 'master_id' => 'varchar(64)', 'used_by' => 'varchar(255)', 'cpu_model' => 'varchar(255)', 'cpu_nb_cores' => 'int(8)', 'ram_total' => 'int(8)', 'status' => 'varchar(32)', 'ip' => 'varchar(15)'); $ret = $SQL->buildTable(self::table, $vdi_table_structure, array('id')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . self::table . '\''); return false; } Logger::debug('main', 'MySQL table \'' . self::table . '\' created'); return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_Network_Folder::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $network_folders_table_structure = array('id' => 'varchar(255)', 'server' => 'varchar(255)', 'status' => 'int(2)'); $ret = $SQL->buildTable(self::$table, $network_folders_table_structure, array('id')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . self::$table . '\''); return false; } Logger::debug('main', 'MySQL table \'' . self::$table . '\' created'); return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_Task::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $tasks_table_structure = array('id' => 'varchar(32)', 'type' => 'varchar(32)', 'job_id' => 'varchar(32)', 'server' => 'varchar(255)', 'status' => 'varchar(64)', 't_begin' => 'int(10)', 't_end' => 'int(10)', 'applications_line' => 'varchar(255)', 'applications' => 'text'); $ret = $SQL->buildTable($sql_conf['prefix'] . 'tasks', $tasks_table_structure, array('id')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . 'tasks\''); return false; } Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . 'tasks\' created'); return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_Token::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $tokens_table_structure = array('id' => 'varchar(255) NOT NULL', 'type' => 'varchar(32) NOT NULL', 'link_to' => 'varchar(255) NOT NULL', 'valid_until' => 'int(10) NOT NULL'); $ret = $SQL->buildTable(self::table, $tokens_table_structure, array('id')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . self::table . '\''); return false; } Logger::debug('main', 'MySQL table \'' . self::table . '\' created'); return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_Script::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $script_table_structure = array('id' => 'int(8) NOT NULL auto_increment', 'name' => 'varchar(64)', 'type' => 'varchar(10)', 'os' => 'varchar(10)', 'data' => 'text'); $ret = $SQL->buildTable(self::$table, $script_table_structure, array('id')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . self::$table . '\''); return false; } Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . self::$table . '\' created'); return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_Session::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $sessions_table_structure = array('id' => 'varchar(255)', 'server' => 'varchar(255)', 'mode' => 'varchar(32)', 'type' => 'varchar(32)', 'status' => 'varchar(32)', 'settings' => 'text', 'user_login' => 'varchar(255)', 'user_displayname' => 'varchar(255)', 'servers' => 'text', 'applications' => 'text', 'start_time' => 'varchar(255)', 'timestamp' => 'int(10)'); $ret = $SQL->buildTable($sql_conf['prefix'] . 'sessions', $sessions_table_structure, array('id')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . 'sessions\''); return false; } Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . 'sessions\' created'); return true; }
public static function init($prefs_) { Logger::debug('main', 'Abstract_User_Preferences::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $user_preferences_table_structure = array('login' => 'varchar(1024)', 'key' => 'varchar(255)', 'container' => 'varchar(255)', 'element_id' => 'varchar(255)', 'value' => 'text'); $ret = $SQL->buildTable(self::$table, $user_preferences_table_structure, array()); if (!$ret) { Logger::error('main', "Unable to create MySQL table '" . self::$table . "'"); return false; } Logger::debug('main', "MySQL table '" . self::$table . "' created"); return true; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_News::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $news_table_structure = array('id' => 'int(8) NOT NULL auto_increment', 'title' => 'varchar(64)', 'content' => 'text', 'timestamp' => 'int(10)'); $ret = $SQL->buildTable($sql_conf['prefix'] . 'news', $news_table_structure, array('id')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . 'news\''); return false; } Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . 'news\' created'); return true; }
public static function init($prefs_) { $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { return false; } $table = $sql_conf['prefix'] . 'ha'; $sql2 = SQL::newInstance($sql_conf); $ha_table_structure = array('id_host' => 'int(5) NOT NULL AUTO_INCREMENT', 'hostname' => 'VARCHAR(255) NOT NULL', 'address' => 'VARCHAR(255) NOT NULL', 'timestamp' => 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP', 'register' => 'ENUM( "yes", "no" ) NOT NULL'); $ret = $sql2->buildTable($table, $ha_table_structure, array('id_host')); if ($ret === false) { return false; } else { return true; } return false; }
public static function init($prefs_) { Logger::debug('main', 'Starting Abstract_Server::init'); $sql_conf = $prefs_->get('general', 'sql'); $SQL = SQL::newInstance($sql_conf); $servers_table_structure = array('fqdn' => 'varchar(255)', 'status' => 'varchar(255)', 'registered' => 'int(8)', 'locked' => 'int(8)', 'type' => 'varchar(255)', 'version' => 'varchar(255)', 'cpu_model' => 'varchar(255)', 'cpu_nb_cores' => 'int(8)', 'cpu_load' => 'int(8)', 'ram_total' => 'int(16)', 'ram_used' => 'int(16)', 'timestamp' => 'int(10)'); $ret = $SQL->buildTable($sql_conf['prefix'] . 'servers', $servers_table_structure, array('fqdn')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . 'servers\''); return false; } Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . 'servers\' created'); $servers_properties_table_structure = array('fqdn' => 'varchar(255)', 'property' => 'varchar(64)', 'value' => 'varchar(255)'); $ret = $SQL->buildTable($sql_conf['prefix'] . 'servers_properties', $servers_properties_table_structure, array('fqdn', 'property')); if (!$ret) { Logger::error('main', 'Unable to create MySQL table \'' . $sql_conf['prefix'] . 'servers_properties\''); return false; } Logger::debug('main', 'MySQL table \'' . $sql_conf['prefix'] . 'servers_properties\' created'); return true; }
public static function init($prefs_) { Logger::debug('main', 'USERGROUPDB::sql::init'); $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { Logger::error('main', 'USERGROUPDB::sql::init sql conf is not valid'); return false; } $usersgroup_table = $sql_conf['prefix'] . 'usergroup'; $sql2 = SQL::newInstance($sql_conf); $usersgroup_table_structure = array('id' => 'int(8) NOT NULL auto_increment', 'name' => 'varchar(150) NOT NULL', 'description' => 'varchar(150) NOT NULL', 'published' => 'tinyint(1) NOT NULL'); $ret = $sql2->buildTable($usersgroup_table, $usersgroup_table_structure, array('id')); if ($ret === false) { Logger::error('main', 'USERGROUPDB::sql::init table ' . $usersgroup_table . ' fail to created'); return false; } return true; }
public static function init($prefs_) { Logger::debug('main', 'WebAppConfDB::sql::init'); $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { Logger::error('main', 'WebAppConfDB::sql::init sql conf not valid'); return false; } $sql2 = SQL::newInstance($sql_conf); $WEBAPPCONF_table_structure = array('id' => 'int(8) NOT NULL auto_increment', 'application_id' => 'int(8) NOT NULL', 'url_prefix' => 'text NOT NULL', 'raw_configuration' => 'text NOT NULL', 'values' => 'text NOT NULL'); $ret = $sql2->buildTable(self::table, $WEBAPPCONF_table_structure, array('id')); if ($ret === false) { Logger::error('main', 'WebAppConfDB::sql::init table ' . self::table . ' fail to created'); return false; } else { Logger::debug('main', 'WebAppConfDB::sql::init table ' . self::table . ' created'); return true; } }
public function isValid() { Logger::debug('main', 'PREFERENCESADMIN::isValid'); if (!function_exists('curl_init')) { return _('Please install CURL support for PHP'); } $sql_conf = $this->get('general', 'sql'); if (!is_array($sql_conf)) { Logger::error('main', 'PREFERENCESADMIN::isValid db conf failed'); return _('SQL configuration not valid(2)'); } $sql2 = SQL::newInstance($sql_conf); $db_ok = $sql2->CheckLink(false); if ($db_ok === false) { Logger::error('main', 'PREFERENCESADMIN::isValid db link failed'); return _('SQL configuration not valid'); } // now we can initialize the system (sql DB ...) $ret = init_db($this); if ($ret !== true) { Logger::error('main', 'init_db failed'); return _('Initialization failed'); } $modules_ok = true; $modules_enable = $this->get('general', 'module_enable'); foreach ($modules_enable as $module_name) { if (!is_null($this->get($module_name, 'enable'))) { $enable = $this->get($module_name, 'enable'); if (is_string($enable)) { $mod_name = $module_name . '_' . $enable; $ret_eval = call_user_func(array($mod_name, 'prefsIsValid'), $this); if ($ret_eval !== true) { Logger::error('main', 'prefs is not valid for module \'' . $mod_name . '\''); $modules_ok = false; return _('prefs is not valid for module') . ' (' . $mod_name . ')'; // TODO } } else { if (is_array($enable)) { foreach ($enable as $sub_module) { $mod_name = $module_name . '_' . $sub_module; $ret_eval = call_user_func(array($mod_name, 'prefsIsValid'), $this); if ($ret_eval !== true) { Logger::error('main', 'prefs is not valid for module \'' . $mod_name . '\''); $modules_ok = false; return _('prefs is not valid for module') . ' (' . $mod_name . ')'; // TODO } } } } } else { Logger::info('main', 'preferences::isvalid module \'' . $module_name . '\' not enable'); } } if ($modules_ok === false) { Logger::error('main', 'PREFERENCESADMIN::isValid modules false'); return _('Modules configuration not valid'); } return true; }
public static function init($prefs_) { $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { Logger::error('main', 'Abstract_Liaison::init sql conf not valid'); return false; } $LIAISON_TABLE = $sql_conf['prefix'] . 'liaison'; // we create the sql table $sql2 = SQL::newInstance($sql_conf); $LIAISON_table_structure = array('type' => 'varchar(200) NOT NULL', 'element' => 'varchar(200) NOT NULL', 'group' => 'varchar(200) NOT NULL'); $ret = $sql2->buildTable($LIAISON_TABLE, $LIAISON_table_structure, array()); if ($ret === false) { Logger::error('main', 'Abstract_Liaison::init table ' . $LIAISON_TABLE . ' fail to created'); return false; } else { Logger::debug('main', 'Abstract_Liaison::init table ' . $LIAISON_TABLE . ' created'); return true; } }
public static function prefsIsValid2($prefs_, &$log = array()) { $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { Logger::error('main', 'UserGroupDBDynamic::internal::prefsIsValid2 failed to get sql configuration'); return false; } $sql2 = SQL::newInstance($sql_conf); $ret = $sql2->DoQuery('SHOW TABLES FROM @1 LIKE %2', $sql_conf['database'], $sql2->prefix . self::table); if ($ret !== false) { $ret2 = $sql2->NumRows($ret); if ($ret2 == 1) { return true; } else { Logger::error('main', 'UserGroupDBDynamic::internal::prefsIsValid table \'' . self::table . '\' does not exist'); return false; } } else { Logger::error('main', 'UserGroupDBDynamic::internal::prefsIsValid table \'' . self::table . '\' does not exist(2)'); return false; } }
public static function init($prefs_) { $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { Logger::error('main', 'Abstract_Liaison::init sql conf not valid'); return false; } // we create the sql table $sql2 = SQL::newInstance($sql_conf); $LIAISON_table_structure = array('type' => 'varchar(200) NOT NULL', 'element' => 'varchar(200) NOT NULL', 'group' => 'varchar(200) NOT NULL'); $ret = $sql2->buildTable(self::table, $LIAISON_table_structure, array(), array('I_TYPE' => array('type'), 'I_ELEMENT' => array('element'), 'I_GROUP' => array('group'))); if ($ret === false) { Logger::error('main', 'Abstract_Liaison::init table ' . self::table . ' fail to created'); return false; } else { Logger::debug('main', 'Abstract_Liaison::init table ' . self::table . ' created'); return true; } }
public static function init($prefs_) { Logger::debug('main', 'APPLICATIONDB::sql::init'); $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { Logger::error('main', 'APPLICATIONDB::sql::init sql conf not valid'); return false; } $sql2 = SQL::newInstance($sql_conf); $APPLICATION_table_structure = array('id' => 'int(8) NOT NULL auto_increment', 'name' => 'text NOT NULL', 'description' => 'text NOT NULL', 'type' => 'text NOT NULL', 'executable_path' => 'text NOT NULL', 'directory' => 'varchar(512)', 'package' => 'text NOT NULL', 'desktopfile' => 'text default NULL', 'published' => 'tinyint(1) default \'0\'', 'static' => 'tinyint(1) default \'0\'', 'revision' => 'int(8) default \'0\''); $ret = $sql2->buildTable(self::table, $APPLICATION_table_structure, array('id')); if ($ret === false) { Logger::error('main', 'APPLICATIONDB::sql::init table ' . self::table . ' fail to created'); return false; } else { Logger::debug('main', 'APPLICATIONDB::sql::init table ' . self::table . ' created'); return true; } }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ //if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) // header('Content-Type: application/xhtml+xml; charset=utf-8'); //else header('Content-Type: text/html; charset=utf-8'); require_once dirname(__FILE__) . '/core-minimal.inc.php'; $folders = array('reporting', 'tmp', 'cache'); foreach ($folders as $folder) { $buf = strtoupper($folder) . '_DIR'; define($buf, SESSIONMANAGER_SPOOL . '/' . $folder); if (!check_folder(constant($buf))) { Logger::critical('main', constant($buf) . ' does not exist and cannot be created!'); die_error(constant($buf) . ' does not exist and cannot be created!', __FILE__, __LINE__); } } $prefs = Preferences::getInstance(); if (is_object($prefs)) { define('HAS_PREFERENCES', true); $sql_conf = $prefs->get('general', 'sql'); if (is_array($sql_conf)) { define('SERVERS_HISTORY_TABLE', $sql_conf['prefix'] . 'servers_history'); define('SESSIONS_HISTORY_TABLE', $sql_conf['prefix'] . 'sessions_history'); SQL::newInstance($sql_conf); } }
public static function prefsIsValid($prefs_, &$log = array()) { $ret = parent::prefsIsValid($prefs_, $log); if ($ret === false) { return false; } $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { return false; } $table = $sql_conf['prefix'] . 'usergroup_dynamic_cached'; $sql2 = SQL::newInstance($sql_conf); $ret = $sql2->DoQuery('SHOW TABLES FROM @1 LIKE %2', $sql_conf['database'], $table); if ($ret !== false) { $ret2 = $sql2->NumRows(); if ($ret2 == 1) { return true; } else { Logger::error('main', 'UserGroupDBDynamic_cached::prefsIsValid table \'' . $table . '\' does not exist'); return false; } } else { Logger::error('main', 'UserGroupDBDynamic_cached::prefsIsValid table \'' . $table . '\' does not exist(2)'); return false; } }
public static function init($prefs_) { Logger::debug('main', 'USERDB::sql::init'); $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { Logger::error('main', 'USERDB::sql::init sql conf not valid'); return false; } $table = $sql_conf['prefix'] . 'user'; $sql2 = SQL::newInstance($sql_conf); $user_table_structure = array('login' => 'varchar(100) NOT NULL', 'displayname' => 'varchar(100) NOT NULL', 'password' => 'varchar(50) NOT NULL'); $ret = $sql2->buildTable($table, $user_table_structure, array('login')); if ($ret === false) { Logger::error('main', 'USERDB::sql::init table ' . $table . ' fail to created'); return false; } else { Logger::debug('main', 'USERDB::sql::init table ' . $table . ' created'); return true; } }
public static function init($prefs_) { Logger::debug('main', 'ApplicationsGroupDB::sql::init'); $sql_conf = $prefs_->get('general', 'sql'); if (!is_array($sql_conf)) { Logger::error('main', 'ApplicationsGroupDB::sql::init sql conf is not valid'); return false; } $sql2 = SQL::newInstance($sql_conf); $appsgroup_structure = array('id' => 'int(8) NOT NULL auto_increment', 'name' => 'varchar(150) NOT NULL', 'description' => 'varchar(150) NOT NULL', 'published' => 'tinyint(1) NOT NULL'); $ret = $sql2->buildTable(self::table, $appsgroup_structure, array('id')); if ($ret === false) { Logger::error('main', 'ApplicationsGroupDB::sql::init table ' . self::table . ' fail to created'); return false; } else { Logger::debug('main', 'ApplicationsGroupDB::sql::init table ' . self::table . ' created'); } return true; }