當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ImpExData::import_usergroup方法代碼示例

本文整理匯總了PHP中ImpExData::import_usergroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImpExData::import_usergroup方法的具體用法?PHP ImpExData::import_usergroup怎麽用?PHP ImpExData::import_usergroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ImpExData的用法示例。


在下文中一共展示了ImpExData::import_usergroup方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: resume

 function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
 {
     // Setup some working variables
     $displayobject->update_basic('displaymodules', 'FALSE');
     $target_db_type = $sessionobject->get_session_var('targetdatabasetype');
     $target_table_prefix = $sessionobject->get_session_var('targettableprefix');
     $source_db_type = $sessionobject->get_session_var('sourcedatabasetype');
     $source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
     $class_num = substr(get_class($this), -3);
     $databasedone = true;
     if (!$sessionobject->get_session_var($class_num . '_start')) {
         $sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
     }
     $displayobject->update_basic('title', 'Modifying database');
     $displayobject->display_now("<h4>Altering tables</h4>");
     $displayobject->display_now("<p>ImpEx will now Alter the tables in the vB database to include <i>import id numbers</i>.</p>");
     $displayobject->display_now("This is needed during the import process for maintaining refrences between the tables during an import.");
     $displayobject->display_now("If you have large tables (i.e. lots of posts) this can take some time.</p>");
     $displayobject->display_now("<p> They will also be left after the import if you need to link back to the origional vB userid.</p>");
     // Add an importids now
     foreach ($this->_import_ids as $id => $table_array) {
         foreach ($table_array as $tablename => $column) {
             if ($this->add_import_id($Db_target, $target_db_type, $target_table_prefix, $tablename, $column)) {
                 $displayobject->display_now("\n<br /><b>{$tablename}</b> - {$column} <i>OK</i>");
             } else {
                 $sessionobject->add_error('fatal', $this->_modulestring, get_class($this) . "::resume failed trying to modify table {$tablename} to add {$column}", 'Check database permissions');
             }
         }
     }
     // Add the importpostid for the attachment imports and the users for good measure
     $this->add_index($Db_target, $target_db_type, $target_table_prefix, 'post');
     $this->add_index($Db_target, $target_db_type, $target_table_prefix, 'user');
     if ($sessionobject->get_session_var('added_default_unknown_group') != 'yup') {
         $try = new ImpExData($Db_target, $sessionobject, 'usergroup');
         $try->set_value('mandatory', 'importusergroupid', '69');
         $try->set_value('nonmandatory', 'title', 'Imported Users');
         $try->import_usergroup($Db_target, $target_db_type, $target_table_prefix);
         $sessionobject->add_session_var('added_default_unknown_group', 'yup');
         unset($try);
     }
     // Check the database connection
     $result = $this->check_database($Db_source, $source_db_type, $source_table_prefix, $sessionobject->get_session_var('sourceexists'));
     $displayobject->display_now($result['text']);
     if ($result['code']) {
         $sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
         $sessionobject->remove_session_var($class_num . '_start');
         $displayobject->update_html($displayobject->module_finished($this->_modulestring, $sessionobject->return_stats($class_num, '_time_taken'), $sessionobject->return_stats($class_num, '_objects_done'), $sessionobject->return_stats($class_num, '_objects_failed')));
         $sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
         $sessionobject->set_session_var(substr(get_class($this), -3), 'FINISHED');
         $sessionobject->set_session_var('module', '000');
         $displayobject->update_basic('displaymodules', 'FALSE');
         $displayobject->update_html($displayobject->print_redirect_001('index.php', $sessionobject->get_session_var('pagespeed')));
     } else {
         $sessionobject->add_session_var($class_num . '_objects_failed', intval($sessionobject->get_session_var($class_num . '_objects_failed')) + 1);
         $displayobject->update_html($displayobject->make_description("{$displayobject->phrases['failed']} {$displayobject->phrases['check_db_permissions']}"));
         $sessionobject->set_session_var('001', 'FAILED');
         $sessionobject->set_session_var('module', '000');
         $displayobject->update_html($displayobject->print_redirect_001('index.php', $sessionobject->get_session_var('pagespeed')));
     }
 }
開發者ID:arikpeterson,項目名稱:vbimpex,代碼行數:60,代碼來源:001.php

示例2: init

 function init(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
 {
     if ($this->check_order($sessionobject, $this->_dependent)) {
         if ($this->_restart) {
             if ($this->restart($sessionobject, $displayobject, $Db_target, $Db_source, 'clear_imported_usergroups')) {
                 $displayobject->display_now("<h4>{$displayobject->phrases['usergroups_cleared']}</h4>");
                 $this->_restart = true;
             } else {
                 $sessionobject->add_error(substr(get_class($this), -3), $displayobject->phrases['usergroup_restart_failed'], $displayobject->phrases['check_db_permissions']);
             }
         }
         // Start up the table
         $displayobject->update_basic('title', $displayobject->phrases['import_usergroup']);
         $displayobject->update_html($displayobject->do_form_header('index', substr(get_class($this), -3)));
         $displayobject->update_html($displayobject->make_hidden_code(substr(get_class($this), -3), 'WORKING'));
         $displayobject->update_html($displayobject->make_table_header($this->_modulestring));
         // Ask some questions
         $displayobject->update_html($displayobject->make_input_code($displayobject->phrases['usergroups_per_page'], 'usergroupperpage', 50));
         // End the table
         $displayobject->update_html($displayobject->do_form_footer($displayobject->phrases['continue'], $displayobject->phrases['reset']));
         // Incative usergroup
         $target_db_type = $sessionobject->get_session_var('targetdatabasetype');
         $target_table_prefix = $sessionobject->get_session_var('targettableprefix');
         $usergroup_object = new ImpExData($Db_target, $sessionobject, 'usergroup');
         $try = phpversion() < '5' ? $usergroup_object : clone $usergroup_object;
         $try->set_value('mandatory', 'importusergroupid', '69');
         $try->set_value('nonmandatory', 'title', "Active {$displayobject->phrases['imported']} {$displayobject->phrases['users']}");
         $try->import_usergroup($Db_target, $target_db_type, $target_table_prefix);
         unset($try);
         $try = phpversion() < '5' ? $usergroup_object : clone $usergroup_object;
         $try = new ImpExData($Db_target, $sessionobject, 'usergroup');
         $try->set_value('mandatory', 'importusergroupid', '70');
         $try->set_value('nonmandatory', 'title', "Inactive {$displayobject->phrases['imported']} {$displayobject->phrases['users']}");
         $try->import_usergroup($Db_target, $target_db_type, $target_table_prefix);
         $sessionobject->add_session_var('added_default_unknown_group', 'yup');
         unset($try);
         // Reset/Setup counters for this
         $sessionobject->add_session_var(substr(get_class($this), -3) . '_objects_done', '0');
         $sessionobject->add_session_var(substr(get_class($this), -3) . '_objects_failed', '0');
         $sessionobject->add_session_var('usergroupstartat', '0');
     } else {
         // Dependant has not been run
         $displayobject->update_html($displayobject->do_form_header('index', ''));
         $displayobject->update_html($displayobject->make_description("<p>{$displayobject->phrases['dependant_on']}<i><b> " . $sessionobject->get_module_title($this->_dependent) . "</b> {$displayobject->phrases['cant_run']}</i> ."));
         $displayobject->update_html($displayobject->do_form_footer($displayobject->phrases['continue'], ''));
         $sessionobject->set_session_var(substr(get_class($this), -3), 'FALSE');
         $sessionobject->set_session_var('module', '000');
     }
 }
開發者ID:arikpeterson,項目名稱:vbimpex,代碼行數:49,代碼來源:003.php


注:本文中的ImpExData::import_usergroup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。