Exemple #1
0
	$merge_data = new vB_Template_Merge_Data($vbulletin);
	$merge_data->start_offset = $vbulletin->GPC['startat'];

	if ($vbulletin->GPC['product'] == 'vbulletin' OR !$vbulletin->GPC['product'])
	{
		$merge_data->add_condition("tnewmaster.product IN ('', 'vbulletin')");
	}
	else
	{
		$merge_data->add_condition("tnewmaster.product = '" . $db->escape_string($vbulletin->GPC['product']) . "'");

		$merge->merge_version = $full_product_info[$vbulletin->GPC['product']]['version'];
	}

	$completed = $merge->merge_templates($merge_data);

	if ($completed)
	{
		// completed
		build_all_styles();

		if ($vbulletin->GPC['redirect'])
		{
			define('CP_REDIRECT', $vbulletin->GPC['redirect']);
		}

		print_stop_message('templates_merged');
	}
	else
	{
 /**
  * Template Merge
  *
  * @param	array	contains start info
  * @param	int		Master styleid
  *
  */
 function merge_templates($data, $mastertype)
 {
     if ($data['options']['skiptemplatemerge']) {
         $this->skip_message();
         return;
     }
     if ($data['response'] == 'timeout') {
         $this->show_message($this->phrase['final']['step_timed_out']);
         return;
     }
     $this->show_message($this->phrase['final']['merge_template_changes']);
     $startat = intval($data['startat']);
     require_once DIR . '/includes/class_template_merge.php';
     $products = array("''", "'vbulletin'", "'skimlinks'", "'forumrunner'", "'postrelease'");
     if (should_install_suite()) {
         $products = array_merge($products, array("'vbblog'", "'vbcms'"));
     }
     $merge_data = new vB_Template_Merge_Data($this->registry);
     $merge_data->start_offset = $startat;
     $merge_data->add_condition($c = "tnewmaster.product IN (" . implode(', ', $products) . ")");
     $merge = new vB_Template_Merge($this->registry);
     $merge->time_limit = 4;
     $output = array();
     $completed = $merge->merge_templates($merge_data, $output, $mastertype == 'standard' ? -1 : -2);
     if ($output) {
         foreach ($output as $message) {
             $this->show_message($message);
         }
     }
     if ($completed) {
         $this->set_option('upgrade_from', 'version', '', 'string', '');
         if ($error = build_all_styles(0, 0, '', true, $mastertype)) {
             $this->add_error($error, self::PHP_TRIGGER_ERROR, true);
             return false;
         }
     } else {
         return array('startat' => $startat + $merge->fetch_processed_count());
     }
 }
 /**
  * Massive merge templates
  *
  * @param string $product Product string ID.
  * @param integer $startat Start offset of the merge.
  *
  * @return integer New startat value. -1 if no more to do.
  */
 public function massMerge($product = 'vbulletin', $startat = 0)
 {
     $this->checkHasAdminPermission('canadmintemplates');
     require_once DIR . '/includes/adminfunctions.php';
     // TODO: Product API
     $full_product_info = fetch_product_list(true);
     $vbulletin =& vB::get_registry();
     require_once DIR . '/includes/class_template_merge.php';
     require_once DIR . '/includes/adminfunctions_template.php';
     $merge = new vB_Template_Merge($vbulletin);
     $merge->time_limit = 5;
     $merge_data = new vB_Template_Merge_Data($vbulletin);
     $merge_data->start_offset = $startat;
     if ($product == 'vbulletin' or !$product) {
         $merge_data->add_condition("tnewmaster.product IN ('', 'vbulletin')");
     } else {
         $merge_data->add_condition("tnewmaster.product = '" . mysql_escape_string($product) . "'");
         $merge->merge_version = $full_product_info[$product]['version'];
     }
     $completed = $merge->merge_templates($merge_data, $output);
     if ($completed) {
         // completed
         build_all_styles();
         vB_Library::instance('Style')->setCssDate();
         return -1;
     } else {
         return $merge_data->start_offset + $merge->fetch_processed_count();
     }
 }
Exemple #4
0
        $mastertype = 'mobile';
        $masterstyleid = -2;
    }
    verify_cp_sessionhash();
    require_once DIR . '/includes/class_template_merge.php';
    $merge = new vB_Template_Merge($vbulletin);
    $merge->time_limit = 5;
    $merge_data = new vB_Template_Merge_Data($vbulletin);
    $merge_data->start_offset = $vbulletin->GPC['startat'];
    if ($vbulletin->GPC['product'] == 'vbulletin' or !$vbulletin->GPC['product']) {
        $merge_data->add_condition("tnewmaster.product IN ('', 'vbulletin')");
    } else {
        $merge_data->add_condition("tnewmaster.product = '" . $db->escape_string($vbulletin->GPC['product']) . "'");
        $merge->merge_version = $full_product_info[$vbulletin->GPC['product']]['version'];
    }
    $completed = $merge->merge_templates($merge_data, $output, $masterstyleid);
    if ($completed) {
        // completed
        build_all_styles(0, 0, '', false, $mastertype);
        if ($vbulletin->GPC['redirect']) {
            define('CP_REDIRECT', $vbulletin->GPC['redirect']);
        }
        print_stop_message('templates_merged');
    } else {
        // more templates to merge
        print_cp_redirect('template.php?do=massmerge&product=' . urlencode($vbulletin->GPC['product']) . '&hash=' . CP_SESSIONHASH . '&redirect=' . urlencode($vbulletin->GPC['redirect']) . '&mastertype=' . $mastertype . '&startat=' . ($merge_data->start_offset + $merge->fetch_processed_count()));
    }
}
// #############################################################################
// view the history of a template, including old versions and diffs between versions
if ($_REQUEST['do'] == 'history') {