コード例 #1
0
 private function build_form()
 {
     $picture_yes = '<i class="fa fa-success fa-2x" title="' . LangLoader::get_message('yes', 'common') . '"></i>';
     $picture_no = '<i class="fa fa-error fa-2x" title="' . LangLoader::get_message('no', 'common') . '"></i>';
     $picture_unknown = '<i class="fa fa-question fa-2x" title="' . LangLoader::get_message('unknown', 'main') . '"></i>';
     $default_lang_config = LangsManager::get_lang(LangsManager::get_default_lang())->get_configuration();
     $default_theme_config = ThemesManager::get_theme(ThemesManager::get_default_theme())->get_configuration();
     $editors = AppContext::get_content_formatting_service()->get_available_editors();
     $default_editor = $editors[ContentFormattingConfig::load()->get_default_editor()];
     $server_configuration = new ServerConfiguration();
     $general_config = GeneralConfig::load();
     $server_environment_config = ServerEnvironmentConfig::load();
     $sessions_config = SessionsConfig::load();
     $maintenance_config = MaintenanceConfig::load();
     $url_rewriting_available = false;
     $url_rewriting_known = true;
     try {
         $url_rewriting_available = $server_configuration->has_url_rewriting();
     } catch (UnsupportedOperationException $ex) {
         $url_rewriting_known = false;
     }
     $summerization = "---------------------------------System report---------------------------------\n-----------------------------generated by PHPBoost-----------------------------\nSERVER CONFIGURATION-----------------------------------------------------------\nphp version\t\t\t: " . ServerConfiguration::get_phpversion() . "\ndbms version\t\t\t: " . PersistenceContext::get_dbms_utils()->get_dbms_version() . "\ngd library\t\t\t: " . (int) $server_configuration->has_gd_library() . "\nurl rewriting\t\t\t: " . ($url_rewriting_known ? (int) $url_rewriting_available : 'N/A') . "\napcu cache\t\t\t: " . (int) DataStoreFactory::is_apc_available() . "\nPHPBOOST CONFIGURATION---------------------------------------------------------\nphpboost version\t\t: " . Environment::get_phpboost_version() . "\nserver url\t\t\t: " . $general_config->get_site_url() . "\nsite path\t\t\t: " . $general_config->get_site_path() . "\ndefault theme\t\t\t: " . $default_theme_config->get_name() . " (" . LangLoader::get_message('version', 'admin') . " " . $default_theme_config->get_version() . ")\ndefault language\t\t: " . $default_lang_config->get_name() . "\ndefault editor\t\t\t: " . $default_editor . "\nhome page\t\t\t: " . Environment::get_home_page() . "\nurl rewriting\t\t\t: " . (int) $server_environment_config->is_url_rewriting_enabled() . "\napcu cache\t\t\t: " . (int) DataStoreFactory::is_apc_enabled() . "\noutput gzip\t\t\t: " . (int) $server_environment_config->is_output_gziping_enabled() . "\nsession cookie name\t\t: " . $sessions_config->get_cookie_name() . "\nsession duration\t\t: " . $sessions_config->get_session_duration() . "\nactive session duration\t\t: " . $sessions_config->get_active_session_duration() . "\nDIRECTORIES AUTHORIZATIONS-----------------------------------------------------\n";
     $form = new HTMLForm('system-report', '', false);
     $this->get_advises($form);
     $fieldset = new FormFieldsetHTML('report', $this->admin_lang['server']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldFree('php_version', $this->admin_lang['php_version'], ServerConfiguration::get_phpversion()));
     $fieldset->add_field(new FormFieldFree('dbms_version', $this->admin_lang['dbms_version'], PersistenceContext::get_dbms_utils()->get_dbms_version()));
     $fieldset->add_field(new FormFieldFree('gd_library', $this->admin_lang['gd_library'], $server_configuration->has_gd_library() ? $picture_yes : $picture_no));
     $fieldset->add_field(new FormFieldFree('url_rewriting', $this->admin_lang['url_rewriting'], $url_rewriting_known ? $url_rewriting_available ? $picture_yes : $picture_no : $picture_unknown));
     $fieldset->add_field(new FormFieldFree('apcu_cache', LangLoader::get_message('apcu_cache', 'admin-cache-common'), DataStoreFactory::is_apc_available() ? $picture_yes : $picture_no));
     $fieldset = new FormFieldsetHTML('report', $this->admin_lang['phpboost_config']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldFree('kernel_version', $this->admin_lang['kernel_version'], Environment::get_phpboost_version()));
     $fieldset->add_field(new FormFieldFree('site_url', LangLoader::get_message('advanced-config.site_url', 'admin-config-common'), $general_config->get_site_url()));
     $fieldset->add_field(new FormFieldFree('site_path', LangLoader::get_message('advanced-config.site_path', 'admin-config-common'), $general_config->get_site_path()));
     $fieldset->add_field(new FormFieldFree('default_theme', LangLoader::get_message('general-config.default_theme', 'admin-config-common'), $default_theme_config->get_name() . " (" . LangLoader::get_message('version', 'admin') . " " . $default_theme_config->get_version() . ")"));
     $fieldset->add_field(new FormFieldFree('default_language', LangLoader::get_message('general-config.default_language', 'admin-config-common'), $default_lang_config->get_name()));
     $fieldset->add_field(new FormFieldFree('default_editor', LangLoader::get_message('content.config.default-formatting-language', 'admin-contents-common'), $default_editor));
     $fieldset->add_field(new FormFieldFree('start_page', LangLoader::get_message('general-config.start_page', 'admin-config-common'), Environment::get_home_page()));
     $fieldset->add_field(new FormFieldFree('phpboost_url_rewriting', $this->admin_lang['url_rewriting'], $server_environment_config->is_url_rewriting_enabled() ? $picture_yes : $picture_no));
     $fieldset->add_field(new FormFieldFree('phpboost_apcu_cache', LangLoader::get_message('apcu_cache', 'admin-cache-common'), DataStoreFactory::is_apc_enabled() ? $picture_yes : $picture_no));
     $fieldset->add_field(new FormFieldFree('output_gz', $this->admin_lang['output_gz'], $server_environment_config->is_output_gziping_enabled() ? $picture_yes : $picture_no));
     $fieldset->add_field(new FormFieldFree('cookie_name', LangLoader::get_message('advanced-config.cookie-name', 'admin-config-common'), $sessions_config->get_cookie_name()));
     $fieldset->add_field(new FormFieldFree('session_length', LangLoader::get_message('advanced-config.cookie-duration', 'admin-config-common'), $sessions_config->get_session_duration()));
     $fieldset->add_field(new FormFieldFree('session_guest_length', LangLoader::get_message('advanced-config.active-session-duration', 'admin-config-common'), $sessions_config->get_active_session_duration()));
     $fieldset = new FormFieldsetHTML('directories_auth', $this->admin_lang['directories_auth']);
     $form->add_fieldset($fieldset);
     $directories_summerization = '';
     foreach (PHPBoostFoldersPermissions::get_permissions() as $key => $folder) {
         $fieldset->add_field(new FormFieldFree(str_replace('/', '_', $key), $key, $folder->is_writable() ? $picture_yes : $picture_no));
         $directories_summerization .= $key . str_repeat('	', 5 - strlen($key) / 8) . ": " . (int) $folder->is_writable() . "\n";
     }
     $fieldset = new FormFieldsetHTML('summerization', $this->admin_lang['system_report_summerization']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldLabel($this->admin_lang['system_report_summerization_explain']));
     $fieldset->add_field(new FormFieldMultiLineTextEditor('summerization', '', $summerization . $directories_summerization, array('rows' => 20, 'cols' => 15, 'class' => 'system-report')));
     $this->form = $form;
 }
コード例 #2
0
 private function optimize_tables()
 {
     $db_utils = PersistenceContext::get_dbms_utils();
     $tables = $db_utils->list_tables();
     $db_utils->optimize($tables);
     $db_utils->repair($tables);
     CLIOutput::writeln('Database optimized');
 }
コード例 #3
0
 private function dump($file_path, $tables)
 {
     Environment::try_to_increase_max_execution_time();
     $file = new File($file_path);
     $file_writer = new BufferedFileWriter($file);
     if ($tables == null) {
         PersistenceContext::get_dbms_utils()->dump_phpboost($file_writer, DBMSUtils::DUMP_STRUCTURE_AND_DATA);
     } else {
         PersistenceContext::get_dbms_utils()->dump_tables($file_writer, $tables, DBMSUtils::DUMP_STRUCTURE_AND_DATA);
     }
     CLIOutput::writeln('Tables dumped to file ' . $file_path);
 }
コード例 #4
0
 public function __construct($locale = '')
 {
     $this->token = new File(PATH_TO_ROOT . '/cache/.update_token');
     $this->update_followed_file = new File(PATH_TO_ROOT . '/update/update_followed.txt');
     $this->update_followed_file->delete();
     self::$db_utils = PersistenceContext::get_dbms_utils();
     self::$db_querier = PersistenceContext::get_querier();
     if (!empty($locale)) {
         LangLoader::set_locale($locale);
     }
     $this->messages = LangLoader::get('update', 'update');
 }
コード例 #5
0
 private function create_forum_ranks_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'name' => array('type' => 'string', 'length' => 150, 'notnull' => 1, 'default' => "''"), 'msg' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'icon' => array('type' => 'string', 'length' => 255, 'notnull' => 1, 'default' => "''"), 'special' => array('type' => 'boolean', 'length' => 1, 'notnull' => 1, 'default' => 0));
     $options = array('primary' => array('id'));
     PersistenceContext::get_dbms_utils()->create_table(self::$forum_ranks_table, $fields, $options);
 }
コード例 #6
0
 private function create_pages_cats_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'id_page' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'id_parent' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0));
     $options = array('primary' => array('id'));
     PersistenceContext::get_dbms_utils()->create_table(self::$pages_cats_table, $fields, $options);
 }
コード例 #7
0
 private function create_poll_ip_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'ip' => array('type' => 'string', 'length' => 50, 'notnull' => 1, 'default' => "''"), 'user_id' => array('type' => 'integer', 'length' => 11, 'default' => 0), 'idpoll' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'timestamp' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0));
     $options = array('primary' => array('id'));
     PersistenceContext::get_dbms_utils()->create_table(self::$poll_ip_table, $fields, $options);
 }
コード例 #8
0
 public function __construct()
 {
     parent::__construct('shoutbox');
     $this->querier = PersistenceContext::get_querier();
     $this->db_utils = PersistenceContext::get_dbms_utils();
 }
コード例 #9
0
        foreach ($table_structure['fields'] as $fields_info) {
            $tpl->assign_block_vars('fields', array('FIELD_NAME' => $fields_info['name'], 'FIELD_TYPE' => $fields_info['type'], 'FIELD_NULL' => $fields_info['null'] ? LangLoader::get_message('yes', 'common') : LangLoader::get_message('no', 'common'), 'FIELD_VALUE' => TextHelper::strprotect($fields_info['default']), 'C_FIELD_FORM_EXTEND' => $fields_info['type'] == 'text' || $fields_info['type'] == 'mediumtext' ? true : false));
        }
    }
} elseif (!empty($table) && $action == 'optimize') {
    PersistenceContext::get_dbms_utils()->optimize(array($table));
    AppContext::get_response()->redirect('/database/admin_database_tools.php?table=' . $table);
} elseif (!empty($table) && $action == 'truncate') {
    AppContext::get_session()->csrf_get_protect();
    //Protection csrf
    PersistenceContext::get_dbms_utils()->truncate(array($table));
    AppContext::get_response()->redirect('/database/admin_database_tools.php?table=' . $table);
} elseif (!empty($table) && $action == 'drop') {
    AppContext::get_session()->csrf_get_protect();
    //Protection csrf
    PersistenceContext::get_dbms_utils()->drop(array($table));
    AppContext::get_response()->redirect('/database/admin_database_tools.php?table=' . $table);
} elseif (!empty($table) && $action == 'query') {
    $query = retrieve(POST, 'query', '', TSTRING_UNCHANGE);
    $tpl->put_all(array('C_DATABASE_TABLE_QUERY' => true));
    if (!empty($query)) {
        AppContext::get_session()->csrf_get_protect();
        //Protection csrf
        $tpl->put_all(array('C_QUERY_RESULT' => true));
        $lower_query = strtolower($query);
        if (strtolower(substr($query, 0, 6)) == 'select') {
            //On éxécute la requête
            $result = PersistenceContext::get_querier()->select(str_replace('phpboost_', PREFIX, $query));
            $i = 1;
            while ($row = $result->fetch()) {
                $tpl->assign_block_vars('line', array());
コード例 #10
0
 private function create_gallery_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'idcat' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'name' => array('type' => 'string', 'length' => 255, 'default' => "''"), 'path' => array('type' => 'string', 'length' => 255, 'default' => "''"), 'width' => array('type' => 'integer', 'length' => 9, 'notnull' => 1, 'default' => 0), 'height' => array('type' => 'integer', 'length' => 9, 'notnull' => 1, 'default' => 0), 'weight' => array('type' => 'integer', 'length' => 9, 'notnull' => 1, 'default' => 0), 'user_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'aprob' => array('type' => 'boolean', 'notnull' => 1, 'default' => 0), 'views' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'timestamp' => array('type' => 'integer', 'length' => 11, 'default' => 0));
     $options = array('primary' => array('id'), 'indexes' => array('idcat' => array('type' => 'key', 'fields' => 'idcat')));
     PersistenceContext::get_dbms_utils()->create_table(self::$gallery_table, $fields, $options);
 }
コード例 #11
0
ファイル: Backup.class.php プロジェクト: AroundPBT/PHPBoost
 /**
  * @desc Concatenates the tables content insertion queries to the SQL backup script.
  * @param $tables names of the tables which must be filled by the backup script.
  * If you want to generate the query which will fill all the tables, don't use this parameter
  * of let an empty array.
  */
 public function generate_insert_values_query($tables = array())
 {
     $all_tables = count($tables) == 0 ? true : false;
     foreach ($this->tables as $id => $table_info) {
         if ($all_tables || in_array($table_info['name'], $tables)) {
             $rows_number = PersistenceContext::get_querier()->count($table_info['name']);
             if ($rows_number > 0) {
                 $this->backup_script .= "INSERT INTO " . $table_info['name'] . " (`";
                 $this->backup_script .= implode('`, `', PersistenceContext::get_dbms_utils()->desc_table($table_info['name']));
                 $this->backup_script .= "`) VALUES ";
                 $i = 1;
                 $list_fields = PersistenceContext::get_dbms_utils()->desc_table($table_info['name']);
                 $result = $this->db_querier->select('SELECT * FROM ' . $table_info['name']);
                 while ($row = $result->fetch()) {
                     if ($i % 10 == 0) {
                         $this->backup_script .= ";\n";
                         $this->backup_script .= "INSERT INTO " . $table_info['name'] . " (";
                         $this->backup_script .= implode(', ', $list_fields);
                         $this->backup_script .= ") VALUES ";
                     } elseif ($i > 1) {
                         $this->backup_script .= ", ";
                     }
                     $this->backup_script .= "(";
                     foreach ($row as $key => $value) {
                         $row[$key] = '\'' . str_replace(chr(13), '\\r', str_replace(chr(10), '\\n', str_replace('\\', '\\\\', str_replace("'", "''", $value)))) . '\'';
                     }
                     $this->backup_script .= implode(', ', $row) . ")";
                     $i++;
                 }
                 $this->backup_script .= ";\n";
                 $result->dispose();
             }
         }
     }
 }
コード例 #12
0
 private function create_bugtracker_users_filters_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'user_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'page' => array('type' => 'string', 'length' => 64, 'notnull' => 1, 'default' => "''"), 'filters' => array('type' => 'string', 'length' => 64, 'notnull' => 1, 'default' => "''"), 'filters_ids' => array('type' => 'string', 'length' => 64, 'notnull' => 1, 'default' => "''"));
     $options = array('primary' => array('id'), 'indexes' => array('user_id' => array('type' => 'key', 'fields' => 'user_id')));
     PersistenceContext::get_dbms_utils()->create_table(self::$bugtracker_users_filters_table, $fields, $options);
 }
コード例 #13
0
ファイル: admin_database.php プロジェクト: AroundPBT/PHPBoost
                }
            }
        }
        if (!empty($error)) {
            if (trim($error) == 'backup_success' && !empty($file)) {
                $tpl->put('message_helper', MessageHelper::display(sprintf($LANG['db_backup_success'], $file, $file), MessageHelper::SUCCESS));
            }
        }
        //liste des tables
        $i = 0;
        list($nbr_rows, $nbr_data, $nbr_free) = array(0, 0, 0);
        foreach (PersistenceContext::get_dbms_utils()->list_and_desc_tables(true) as $key => $table_info) {
            $free = NumberHelper::round($table_info['data_free'] / 1024, 1);
            $data = NumberHelper::round(($table_info['data_length'] + $table_info['index_length']) / 1024, 1);
            $free = $free > 1024 ? NumberHelper::round($free / 1024, 1) . ' ' . LangLoader::get_message('unit.megabytes', 'common') : $free . ' ' . LangLoader::get_message('unit.kilobytes', 'common');
            $data = $data > 1024 ? NumberHelper::round($data / 1024, 1) . ' ' . LangLoader::get_message('unit.megabytes', 'common') : $data . ' ' . LangLoader::get_message('unit.kilobytes', 'common');
            $tpl->assign_block_vars('table_list', array('TABLE_NAME' => $table_info['name'], 'TABLE_ENGINE' => $table_info['engine'], 'TABLE_ROWS' => $table_info['rows'], 'TABLE_DATA' => $data != 0 ? $data : '-', 'TABLE_FREE' => $free != 0 ? $free : '-', 'TABLE_COLLATION' => $table_info['collation'], 'I' => $i));
            $nbr_rows += $table_info['rows'];
            $nbr_free += $table_info['data_free'];
            $nbr_data += $table_info['data_length'] + $table_info['index_length'];
            $i++;
        }
        $nbr_free = NumberHelper::round($nbr_free / 1024, 1);
        $nbr_data = NumberHelper::round($nbr_data / 1024, 1);
        $nbr_free = $nbr_free > 1024 ? NumberHelper::round($nbr_free / 1024, 1) . ' ' . LangLoader::get_message('unit.megabytes', 'common') : $nbr_free . ' ' . LangLoader::get_message('unit.kilobytes', 'common');
        $nbr_data = $nbr_data > 1024 ? NumberHelper::round($nbr_data / 1024, 1) . ' ' . LangLoader::get_message('unit.megabytes', 'common') : $nbr_data . ' ' . LangLoader::get_message('unit.kilobytes', 'common');
        $tpl->put_all(array('C_DATABASE_INDEX' => true, 'TARGET' => url('admin_database.php?token=' . AppContext::get_session()->get_token()), 'NBR_TABLES' => count(PersistenceContext::get_dbms_utils()->list_tables()), 'NBR_ROWS' => $nbr_rows, 'NBR_DATA' => $nbr_data, 'NBR_FREE' => $nbr_free, 'L_EXPLAIN_ACTIONS' => $LANG['db_explain_actions'], 'L_EXPLAIN_ACTIONS_QUESTION' => $LANG['db_explain_actions.question'], 'L_DB_RESTORE' => $LANG['db_restore'], 'L_RESTORE_FROM_SERVER' => $LANG['db_restore_from_server'], 'L_FILE_LIST' => $LANG['db_view_file_list'], 'L_RESTORE_FROM_UPLOADED_FILE' => sprintf($LANG['import_file_explain'], ini_get('upload_max_filesize')), 'L_RESTORE_NOW' => $LANG['db_restore'], 'L_TABLE_LIST' => $LANG['db_table_list'], 'L_TABLE_NAME' => $LANG['db_table_name'], 'L_TABLE_ROWS' => $LANG['db_table_rows'], 'L_TABLE_ENGINE' => $LANG['db_table_engine'], 'L_TABLE_COLLATION' => $LANG['db_table_collation'], 'L_TABLE_DATA' => $LANG['db_table_data'], 'L_TABLE_FREE' => $LANG['db_table_free'], 'L_SELECTED_TABLES' => $LANG['db_selected_tables'], 'L_ALL' => $LANG['db_select_all'], 'ACTION_FOR_SELECTION' => $LANG['db_for_selected_tables'], 'L_OPTIMIZE' => $LANG['db_optimize'], 'L_REPAIR' => $LANG['db_repair'], 'L_BACKUP' => $LANG['db_backup']));
    }
}
$tpl->display();
require_once '../admin/admin_footer.php';
コード例 #14
0
ファイル: FaqSetup.class.php プロジェクト: AroundPBT/PHPBoost
 private function create_faq_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'id_category' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'q_order' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'question' => array('type' => 'string', 'length' => 255, 'notnull' => 1, 'default' => "''"), 'answer' => array('type' => 'text', 'length' => 65000, 'default' => "''"), 'creation_date' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'author_user_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'approved' => array('type' => 'boolean', 'notnull' => 1, 'default' => 0));
     $options = array('primary' => array('id'), 'indexes' => array('id_category' => array('type' => 'key', 'fields' => 'id_category'), 'title' => array('type' => 'fulltext', 'fields' => 'question'), 'contents' => array('type' => 'fulltext', 'fields' => 'answer')));
     PersistenceContext::get_dbms_utils()->create_table(self::$faq_table, $fields, $options);
 }
コード例 #15
0
 private function create_articles_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'id_category' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'picture_url' => array('type' => 'string', 'length' => 255, 'notnull' => 1), 'title' => array('type' => 'string', 'length' => 250, 'notnull' => 1, 'default' => "''"), 'rewrited_title' => array('type' => 'string', 'length' => 250, 'default' => "''"), 'description' => array('type' => 'text', 'length' => 65000), 'contents' => array('type' => 'text', 'length' => 65000), 'number_view' => array('type' => 'integer', 'length' => 11, 'default' => 0), 'author_user_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'author_name_displayed' => array('type' => 'boolean', 'notnull' => 1, 'default' => 1), 'published' => array('type' => 'integer', 'length' => 1, 'notnull' => 1, 'default' => 0), 'publishing_start_date' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'publishing_end_date' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'date_created' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'date_updated' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'notation_enabled' => array('type' => 'boolean', 'notnull' => 1, 'default' => 1), 'sources' => array('type' => 'text', 'length' => 65000));
     $options = array('primary' => array('id'), 'indexes' => array('id_category' => array('type' => 'key', 'fields' => 'id_category'), 'title' => array('type' => 'fulltext', 'fields' => 'title'), 'description' => array('type' => 'fulltext', 'fields' => 'description'), 'contents' => array('type' => 'fulltext', 'fields' => 'contents')));
     PersistenceContext::get_dbms_utils()->create_table(self::$articles_table, $fields, $options);
 }
コード例 #16
0
 private function create_keywords_relations_table()
 {
     $fields = array('id_in_module' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'module_id' => array('type' => 'string', 'length' => 25, 'default' => "''"), 'id_keyword' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0));
     PersistenceContext::get_dbms_utils()->create_table(self::$keywords_relations_table, $fields);
 }
コード例 #17
0
 private function connect_to_database($dbms, array $db_connection_data, $database)
 {
     DBFactory::init_factory($dbms);
     $connection = DBFactory::new_db_connection();
     DBFactory::set_db_connection($connection);
     try {
         $connection->connect($db_connection_data);
     } catch (UnexistingDatabaseException $exception) {
         PersistenceContext::get_dbms_utils()->create_database($database);
         PersistenceContext::close_db_connection();
         $connection = DBFactory::new_db_connection();
         $connection->connect($db_connection_data);
         DBFactory::set_db_connection($connection);
     }
 }
コード例 #18
0
 private function create_guestbook_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'contents' => array('type' => 'text', 'length' => 65000), 'login' => array('type' => 'string', 'length' => 255, 'notnull' => 1, 'default' => "''"), 'user_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'timestamp' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0));
     $options = array('primary' => array('id'), 'indexes' => array('timestamp' => array('type' => 'key', 'fields' => 'timestamp')));
     PersistenceContext::get_dbms_utils()->create_table(self::$guestbook_table, $fields, $options);
 }
コード例 #19
0
 private static function optimize_database_tables(Date $current_date)
 {
     if (ModulesManager::is_module_installed('database')) {
         $database_config = DatabaseConfig::load();
         if ($database_config->is_database_tables_optimization_enabled()) {
             if ($database_config->get_database_tables_optimization_day() == 7 && $current_date->get_day() == 1 || $database_config->get_database_tables_optimization_day() == $current_date->get_day_of_week()) {
                 $tables_to_optimize = array();
                 foreach (PersistenceContext::get_dbms_utils()->list_and_desc_tables(true) as $key => $table_info) {
                     if (NumberHelper::round($table_info['data_free'] / 1024, 1) != 0) {
                         $tables_to_optimize[] = $key;
                     }
                 }
                 PersistenceContext::get_dbms_utils()->optimize($tables_to_optimize);
             }
         }
     }
 }
コード例 #20
0
 private function create_calendar_users_relation_table()
 {
     $fields = array('event_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'user_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0));
     $options = array('indexes' => array('event_id' => array('type' => 'key', 'fields' => 'event_id'), 'user_id' => array('type' => 'key', 'fields' => 'user_id')));
     PersistenceContext::get_dbms_utils()->create_table(self::$calendar_users_relation_table, $fields, $options);
 }
コード例 #21
0
 private function create_media_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'idcat' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'iduser' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => -1), 'timestamp' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'name' => array('type' => 'string', 'length' => 100, 'notnull' => 1, 'default' => "''"), 'contents' => array('type' => 'text', 'length' => 65000), 'url' => array('type' => 'text', 'length' => 2048), 'mime_type' => array('type' => 'string', 'length' => 255, 'notnull' => 1, 'default' => 0), 'infos' => array('type' => 'integer', 'length' => 6, 'notnull' => 1, 'default' => 0), 'width' => array('type' => 'integer', 'length' => 9, 'notnull' => 1, 'default' => 100), 'height' => array('type' => 'integer', 'length' => 9, 'notnull' => 1, 'default' => 100), 'counter' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0));
     $options = array('primary' => array('id'), 'indexes' => array('idcat' => array('type' => 'key', 'fields' => 'idcat'), 'name' => array('type' => 'fulltext', 'fields' => 'name'), 'contents' => array('type' => 'fulltext', 'fields' => 'contents')));
     PersistenceContext::get_dbms_utils()->create_table(self::$media_table, $fields, $options);
 }
コード例 #22
0
 private function drop_tables()
 {
     PersistenceContext::get_dbms_utils()->drop(array(self::$stats_table, self::$stats_referer_table));
 }
コード例 #23
0
 public static function create_categories_table($table_name)
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'name' => array('type' => 'string', 'length' => 255, 'notnull' => 1), 'rewrited_name' => array('type' => 'string', 'length' => 250, 'default' => "''"), 'description' => array('type' => 'text', 'length' => 65000), 'c_order' => array('type' => 'integer', 'length' => 11, 'unsigned' => 1, 'notnull' => 1, 'default' => 0), 'special_authorizations' => array('type' => 'boolean', 'notnull' => 1, 'default' => 0), 'auth' => array('type' => 'text', 'length' => 65000), 'image' => array('type' => 'string', 'length' => 255, 'notnull' => 1), 'id_parent' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0));
     $options = array('primary' => array('id'));
     PersistenceContext::get_dbms_utils()->create_table($table_name, $fields, $options);
 }
コード例 #24
0
 public static function __static()
 {
     self::$db_utils = PersistenceContext::get_dbms_utils();
     self::$search_index_table = PREFIX . 'search_index';
     self::$search_results_table = PREFIX . 'search_results';
 }
コード例 #25
0
 private function create_news_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'id_category' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'name' => array('type' => 'string', 'length' => 250, 'notnull' => 1, 'default' => "''"), 'rewrited_name' => array('type' => 'string', 'length' => 250, 'default' => "''"), 'contents' => array('type' => 'text', 'length' => 65000), 'short_contents' => array('type' => 'text', 'length' => 65000), 'creation_date' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'updated_date' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'approbation_type' => array('type' => 'integer', 'length' => 1, 'notnull' => 1, 'default' => 0), 'start_date' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'end_date' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'top_list_enabled' => array('type' => 'boolean', 'notnull' => 1, 'notnull' => 1, 'default' => 0), 'picture_url' => array('type' => 'string', 'length' => 255, 'notnull' => 1), 'author_user_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1, 'default' => 0), 'sources' => array('type' => 'text', 'length' => 65000));
     $options = array('primary' => array('id'), 'indexes' => array('id_category' => array('type' => 'key', 'fields' => 'id_category'), 'title' => array('type' => 'fulltext', 'fields' => 'name'), 'contents' => array('type' => 'fulltext', 'fields' => 'contents'), 'short_contents' => array('type' => 'fulltext', 'fields' => 'short_contents')));
     PersistenceContext::get_dbms_utils()->create_table(self::$news_table, $fields, $options);
 }
コード例 #26
0
 private function create_newsletter_subscriptions_table()
 {
     $fields = array('id' => array('type' => 'integer', 'length' => 11, 'autoincrement' => true, 'notnull' => 1), 'stream_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1), 'subscriber_id' => array('type' => 'integer', 'length' => 11, 'notnull' => 1));
     $options = array('primary' => array('id'));
     PersistenceContext::get_dbms_utils()->create_table(self::$newsletter_table_subscriptions, $fields, $options);
 }