本文整理汇总了PHP中fn_get_contents函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_contents函数的具体用法?PHP fn_get_contents怎么用?PHP fn_get_contents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_contents函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: smarty_function_script
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
function smarty_function_script($params, &$smarty)
{
static $scripts = array();
static $packer_loaded = false;
/*if (!empty($params['include'])) {
return implode("\n", $scripts);
}*/
if (!isset($scripts[$params['src']])) {
$path = Registry::get('config.current_path');
if (Registry::get('config.tweaks.js_compression') == true && strpos($params['src'], 'lib/') === false) {
if (!file_exists(DIR_CACHE . $params['src'])) {
if ($packer_loaded == false) {
include_once DIR_LIB . 'packer/class.JavaScriptPacker.php';
$packer_loaded = true;
}
fn_mkdir(dirname(DIR_CACHE . $params['src']));
$packer = new JavaScriptPacker(fn_get_contents(DIR_ROOT . '/' . $params['src']));
fn_put_contents(DIR_CACHE . $params['src'], $packer->pack());
}
$path = Registry::get('config.cache_path');
}
$scripts[$params['src']] = '<script type="text/javascript" src="' . $path . '/' . $params['src'] . '"></script>';
// If output is captured, don't print script tag in the buffer, it will be printed directly to the screen
if (!empty($smarty->_in_capture)) {
$buff = array_pop($smarty->_in_capture);
$smarty->_in_capture[] = $buff;
$smarty->_scripts[$buff][] = $scripts[$params['src']];
return '';
}
return $scripts[$params['src']];
}
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:37,代码来源:function.script.php
示例2: process_sbrf_currencies
public static function process_sbrf_currencies($primary_currency = CART_PRIMARY_CURRENCY)
{
$date = date('d/m/Y');
$link = 'http://www.cbr.ru/scripts/XML_daily.asp?date_req=' . $date;
$xml = @simplexml_load_string(fn_get_contents($link));
$sbrf_currencies = self::format_sbrf_currensies($xml);
if (empty($sbrf_currencies) || $primary_currency != CURRENCY_RUB && !isset($sbrf_currencies[$primary_currency])) {
return false;
}
$currencies = Registry::get('currencies');
if ($primary_currency != CURRENCY_RUB) {
if (isset($sbrf_currencies[$primary_currency]) && isset($currencies[CURRENCY_RUB])) {
$primary_coefficient = $sbrf_currencies[$primary_currency]['nominal'] / $sbrf_currencies[$primary_currency]['value'];
$currency_data = array('coefficient' => $primary_coefficient);
db_query("UPDATE ?:currencies SET ?u WHERE currency_code = ?s", $currency_data, CURRENCY_RUB);
}
unset($sbrf_currencies[$primary_currency]);
foreach ($currencies as $curr_code => $curr_data) {
if (isset($sbrf_currencies[$curr_code])) {
$coefficient_rub = $sbrf_currencies[$curr_code]['nominal'] / $sbrf_currencies[$curr_code]['value'];
$currency_data = array('coefficient' => $primary_coefficient / $coefficient_rub);
db_query("UPDATE ?:currencies SET ?u WHERE currency_code = ?s ", $currency_data, $curr_code);
}
}
} else {
foreach ($currencies as $curr_code => $curr_data) {
if (isset($sbrf_currencies[$curr_code])) {
$currency_data = array('coefficient' => $sbrf_currencies[$curr_code]['value'] / $sbrf_currencies[$curr_code]['nominal']);
db_query("UPDATE ?:currencies SET ?u WHERE currency_code = ?s ", $currency_data, $curr_code);
}
}
}
return true;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:34,代码来源:RusCurrency.php
示例3: fn_replace_rewrite_condition
function fn_replace_rewrite_condition($file_name, $condition, $comment)
{
if (!empty($condition)) {
$condition = "\n" . "# {$comment}\n" . "<IfModule mod_rewrite.c>\n" . "RewriteEngine on\n" . $condition . "</IfModule>\n" . "# /{$comment}";
}
$content = fn_get_contents($file_name);
if ($content === false) {
$content = '';
} elseif (!empty($content)) {
// remove old instructions
$data = explode("\n", $content);
$remove_start = false;
foreach ($data as $k => $line) {
if (preg_match("/# {$comment}/", $line)) {
$remove_start = true;
}
if ($remove_start) {
unset($data[$k]);
}
if (preg_match("/# \\/{$comment}/", $line)) {
$remove_start = false;
}
}
$content = implode("\n", $data);
}
$content .= $condition;
return fn_put_contents($file_name, $content);
}
开发者ID:askzap,项目名称:ultimate,代码行数:28,代码来源:func.php
示例4: smarty_block_scripts
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
function smarty_block_scripts($params, $content, &$smarty, &$repeat)
{
if ($repeat == true) {
Registry::set('runtime.inside_scripts', 1);
return;
}
if (Registry::get('config.tweaks.dev_js')) {
$content .= smarty_helper_inline_scripts($params, $content, $smarty, $repeat);
return $content;
}
$scripts = array();
$external_scripts = array();
$dir_root = Registry::get('config.dir.root');
$return = '';
$current_location = Registry::get('config.current_location');
if (preg_match_all('/\\<script(.*?)\\>(.*?)\\<\\/script\\>/s', $content, $m)) {
$contents = '';
foreach ($m[1] as $src) {
if (!empty($src) && preg_match('/src ?= ?"([^"]+)"/', $src, $_m)) {
if (strpos($_m[1], $current_location) !== false) {
$scripts[] = str_replace($current_location, '', preg_replace('/\\?.*?$/', '', $_m[1]));
} else {
$external_scripts[] = $_m[1];
}
}
}
// Check file changes in dev mode
$names = $scripts;
if (Development::isEnabled('compile_check')) {
foreach ($names as $index => $name) {
if (is_file($dir_root . '/' . $name)) {
$names[$index] .= filemtime($dir_root . '/' . $name);
}
}
}
$filename = 'js/tygh/scripts-' . md5(implode(',', $names)) . fn_get_storage_data('cache_id') . '.js';
if (!Storage::instance('statics')->isExist($filename)) {
foreach ($scripts as $src) {
$contents .= fn_get_contents(Registry::get('config.dir.root') . $src);
}
$contents = str_replace('[files]', implode("\n", $scripts), Registry::get('config.js_css_cache_msg')) . $contents;
$contents = Minifier::minify($contents, array('flaggedComments' => false));
Storage::instance('statics')->put($filename, array('contents' => $contents, 'compress' => false, 'caching' => true));
}
$return = '<script type="text/javascript" src="' . Storage::instance('statics')->getUrl($filename) . '?ver=' . PRODUCT_VERSION . '"></script>' . "\n";
if (!empty($external_scripts)) {
foreach ($external_scripts as $sc) {
$return .= '<script type="text/javascript" src="' . $sc . '"></script>' . "\n";
}
}
foreach ($m[2] as $sc) {
if (!empty($sc)) {
$return .= '<script type="text/javascript">' . $sc . '</script>' . "\n";
}
}
$return .= smarty_helper_inline_scripts($params, $content, $smarty, $repeat);
}
return $return;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:64,代码来源:block.scripts.php
示例5: init
static function init()
{
if (!is_dir(DIR_CACHE)) {
fn_mkdir(DIR_CACHE);
}
$ch = fn_get_contents(DIR_CACHE . self::$_handlers_name);
self::$_cache_handlers = !empty($ch) ? @unserialize($ch) : array();
return true;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:9,代码来源:class.cache_backend_file.php
示例6: acquireLock
public function acquireLock($key, $cache_level)
{
$fname = $this->_mapTags('locks') . '/' . $key . $cache_level;
if (file_exists($fname)) {
$ttl = fn_get_contents($fname);
if ($ttl < time()) {
// lock expired
return fn_put_contents($fname, time() + Registry::LOCK_EXPIRY);
}
} else {
return fn_put_contents($fname, time() + Registry::LOCK_EXPIRY);
}
return false;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:14,代码来源:File.php
示例7: fn_get_google_categories
function fn_get_google_categories($lang_code = DEFAULT_LANGUAGE)
{
$urls = fn_google_export_available_categories();
if (empty($urls[$lang_code])) {
return false;
}
$url = $urls[$lang_code];
$content = fn_get_contents($url);
if ($content) {
$result = explode("\n", $content);
$result = array_diff($result, array(''));
return array_slice($result, 1);
}
return false;
}
开发者ID:askzap,项目名称:ultimate,代码行数:15,代码来源:func.php
示例8: downloadPackage
/**
* Downloads upgrade package from the Upgade server
*
* @param array $schema Package schema
* @param string $package_path Path where the upgrade pack must be saved
* @return bool True if upgrade package was successfully downloaded, false otherwise
*/
public function downloadPackage($schema, $package_path)
{
$data = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?dispatch=product_updates.get_package&package_id=' . $schema['package_id'] . '&edition=' . PRODUCT_EDITION . '&license_number=' . $this->uc_settings['license_number']);
if (!empty($data)) {
fn_put_contents($package_path, $data);
if (md5_file($package_path) == $schema['md5']) {
$result = array(true, '');
} else {
fn_rm($package_path);
$result = array(false, __('text_uc_broken_package'));
}
} else {
$result = array(false, __('text_uc_cant_download_package'));
}
return $result;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:23,代码来源:Connector.php
示例9: smarty_block_scripts
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
function smarty_block_scripts($params, $content, &$smarty, &$repeat)
{
if ($repeat == true) {
return;
}
if (Registry::get('config.tweaks.dev_js')) {
return $content;
}
$scripts = array();
$dir_root = Registry::get('config.dir.root');
$return = '';
if (preg_match_all('/\\<script(.*?)\\>(.*?)\\<\\/script\\>/s', $content, $m)) {
$contents = '';
foreach ($m[1] as $src) {
if (!empty($src) && preg_match('/src ?= ?"([^"]+)"/', $src, $_m)) {
$scripts[] = str_replace(Registry::get('config.current_location'), '', preg_replace('/\\?.*?$/', '', $_m[1]));
}
}
// Check file changes in dev mode
$names = $scripts;
if (Development::isEnabled('compile_check')) {
foreach ($names as $index => $name) {
if (is_file($dir_root . '/' . $name)) {
$names[$index] .= filemtime($dir_root . '/' . $name);
}
}
}
$gz_suffix = Registry::get('config.tweaks.gzip_css_js') ? '.gz' : '';
$filename = 'js/tygh/scripts-' . md5(implode(',', $names)) . fn_get_storage_data('cache_id') . '.js';
if (!Storage::instance('statics')->isExist($filename . $gz_suffix)) {
foreach ($scripts as $src) {
$contents .= fn_get_contents(Registry::get('config.dir.root') . $src);
}
$contents = str_replace('[files]', implode("\n", $scripts), Registry::get('config.js_css_cache_msg')) . $contents;
Storage::instance('statics')->put($filename . $gz_suffix, array('contents' => $contents, 'compress' => Registry::get('config.tweaks.gzip_css_js'), 'caching' => true));
}
$return = '<script type="text/javascript" src="' . Storage::instance('statics')->getUrl($filename) . '?ver=' . PRODUCT_VERSION . '"></script>';
foreach ($m[2] as $sc) {
if (!empty($sc)) {
$return .= '<script type="text/javascript">' . $sc . '</script>' . "\n";
}
}
}
return $return;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:50,代码来源:block.scripts.php
示例10: updateUaRules
public static function updateUaRules()
{
$update_needed = false;
if (!file_exists(TWIGMO_UA_RULES_FILE)) {
$update_needed = true;
} else {
$rules_serialized = fn_get_contents(TWIGMO_UA_RULES_FILE);
$md5_on_twigmo = Http::get(TWG_CHECK_UA_UPDATES);
if (md5($rules_serialized) != $md5_on_twigmo) {
$update_needed = true;
}
}
if (!$update_needed) {
return;
}
$rules_on_twigmo = Http::get(TWG_UA_RULES);
fn_twg_write_to_file(TWIGMO_UA_RULES_FILE, $rules_on_twigmo, false);
}
开发者ID:askzap,项目名称:ultimate,代码行数:18,代码来源:UserAgent.php
示例11: downloadPackage
public function downloadPackage($schema, $package_path)
{
if (!empty($schema['download_key'])) {
$upgrade_path = $this->settings['packages_server'] . $this->settings['addon'] . '/' . $schema['file'];
$addon_upgrades_dir = Registry::get('config.dir.addons') . $this->settings['addon'] . '/upgrades/';
$addon_upgrades_path = $addon_upgrades_dir . $schema['file'];
if (!file_exists($addon_upgrades_path)) {
fn_mkdir($addon_upgrades_dir);
$addon_upgrade_data = fn_get_contents($upgrade_path);
fn_put_contents($addon_upgrades_path, $addon_upgrade_data);
}
$result = fn_copy($addon_upgrades_path, $package_path);
if ($result) {
fn_rm($addon_upgrades_path);
}
//cleanup
$message = $result ? '' : __('failed') . '-' . $addon_upgrades_path;
return array($result, $message);
} else {
return array(false, __($schema['error_message']));
}
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:22,代码来源:Connector.php
示例12: get_data
function get_data($url)
{
if (is_numeric($url)) {
return new FetchedDataURL($this->content[$url], array(), "");
} else {
if (substr($url, 0, 8) == 'file:///') {
$url = substr($url, 10);
if (defined('IS_WINDOWS')) {
$url = substr($url, 1);
}
}
if (strpos($url, Registry::get('config.http_location')) === 0) {
$file = str_replace(Registry::get('config.http_location'), DIR_ROOT, $url);
} elseif (strpos($url, Registry::get('config.https_location')) === 0) {
$file = str_replace(Registry::get('config.https_location'), DIR_ROOT, $url);
}
if (!empty($file) && file_exists($file)) {
$result = fn_get_contents($file);
} else {
list(, $result) = fn_http_request('GET', $url);
}
return new FetchedDataURL($result, array(), "");
}
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:24,代码来源:class.pdf_converter.php
示例13: fn_get_url_data
/**
* Get data from url
*
* @param string $val
* @return array $val
*/
function fn_get_url_data($val)
{
if (!preg_match('/:\\/\\//', $val)) {
$val = 'http://' . $val;
}
$result = false;
$_data = fn_get_contents($val);
if (!empty($_data)) {
$result = array('name' => fn_basename($val));
// Check if the file is dynamically generated
if (strpos($result['name'], '&') !== false || strpos($result['name'], '?') !== false) {
$result['name'] = 'url_uploaded_file_' . uniqid(TIME);
}
$result['path'] = fn_create_temp_file();
$result['size'] = strlen($_data);
$fd = fopen($result['path'], 'wb');
fwrite($fd, $_data, $result['size']);
fclose($fd);
@chmod($result['path'], DEFAULT_FILE_PERMISSIONS);
$cache = Registry::get('temp_fs_data');
if (!isset($cache[$result['path']])) {
// cache file to allow multiple usage
$cache[$result['path']] = $result['path'];
Registry::set('temp_fs_data', $cache);
}
}
return $result;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:34,代码来源:fn.fs.php
示例14: checkStoreImportAvailability
public static function checkStoreImportAvailability($license_number, $version, $edition = PRODUCT_EDITION)
{
$request = array('dispatch' => 'product_updates.check_storeimport_available', 'license_key' => $license_number, 'ver' => $version, 'edition' => $edition);
$data = Http::get(Registry::get('config.resources.updates_server'), $request, array('timeout' => 10));
if (empty($data)) {
$data = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?' . http_build_query($request));
}
$result = false;
if (!empty($data)) {
// Check if we can parse server response
if (strpos($data, '<?xml') !== false) {
$xml = simplexml_load_string($data);
$result = (string) $xml == 'Y' ? true : false;
}
}
return $result;
}
开发者ID:askzap,项目名称:ultimate,代码行数:17,代码来源:Helpdesk.php
示例15: fn_get_lang_var
// Set system notifications
if (Registry::get('config.demo_mode') != true && AREA == 'A' && !defined('DEVELOPMENT')) {
// If username equals to the password
if ($password == $user_data['user_login']) {
$msg = fn_get_lang_var('warning_insecure_password');
$msg = str_replace('[link]', fn_url('profiles.update'), $msg);
fn_set_notification('E', fn_get_lang_var('warning'), $msg, true, 'insecure_password');
}
// Insecure admin script
if (Registry::get('config.admin_index') == 'admin.php') {
fn_set_notification('E', fn_get_lang_var('warning'), fn_get_lang_var('warning_insecure_admin_script'), true);
}
if (Registry::get('settings.General.auto_check_updates') == 'Y' && fn_check_user_access($auth['user_id'], 'upgrade_store')) {
// If upgrades available
$uc_settings = fn_get_settings('Upgrade_center');
$data = fn_get_contents($uc_settings['updates_server'] . '/index.php?target=product_updates&mode=check_available&ver=' . PRODUCT_VERSION);
/* NULLED BY FLIPMODE! @ 2010/09/06 */
// $data = fn_get_contents($uc_settings['updates_server'] . '/index.php?target=product_updates&mode=check_available&ver=' . PRODUCT_VERSION . '&license_number=' . $uc_settings['license_number']);
if ($data == 'AVAILABLE') {
$msg = fn_get_lang_var('text_upgrade_available');
$msg = str_replace('[link]', fn_url('upgrade_center.manage'), $msg);
fn_set_notification('W', fn_get_lang_var('notice'), $msg, true, 'upgrade_center');
}
}
}
if (!empty($_REQUEST['remember_me'])) {
fn_set_cookie(AREA_NAME . '_user_id', $user_data['user_id'], COOKIE_ALIVE_TIME);
fn_set_cookie(AREA_NAME . '_password', $user_data['password'], COOKIE_ALIVE_TIME);
}
// Set last login time
db_query("UPDATE ?:users SET ?u WHERE user_id = ?i", array('last_login' => TIME), $user_data['user_id']);
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:auth.php
示例16: fn_get_url_data
/**
* Get data from url
*
* @param string $val
* @return array $val
*/
function fn_get_url_data($val)
{
$tmp = fn_strip_slashes($val);
$_data = fn_get_contents($tmp);
if (!empty($_data)) {
$val = array();
$val['name'] = basename($tmp);
// Check if the file is dynamically generated
if (strpos($val['name'], '&') !== false || strpos($val['name'], '?') !== false) {
$val['name'] = 'url_uploaded_file_' . uniqid(TIME);
}
$val['path'] = fn_create_temp_file();
$val['size'] = strlen($_data);
$fd = fopen($val['path'], 'wb');
fwrite($fd, $_data, $val['size']);
fclose($fd);
@chmod($val['path'], DEFAULT_FILE_PERMISSIONS);
$cache =& Registry::get('temp_fs_data');
if (!isset($cache[$val['path']])) {
// cache file to allow multiple usage
$cache[$val['path']] = $val['path'];
}
}
return $val;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:fn.fs.php
示例17: fn_set_notification
} else {
fn_set_notification('E', __('error'), __('you_have_no_permissions'));
}
exit;
} elseif ($mode == 'restore') {
$copied = false;
$file_path = fn_te_normalize_path($_REQUEST, $root_dir);
if (fn_te_check_path($file_path)) {
$repo_path = str_replace($root_dir, fn_te_get_root('repo'), $file_path);
if (!file_exists($repo_path) && fn_get_theme_path('[theme]') != Registry::get('config.base_theme') && is_dir(fn_get_theme_path('[repo]/[theme]'))) {
$repo_path = preg_replace("/\\/themes_repository\\/(\\w+)\\//", "/themes_repository/" . Registry::get('config.base_theme') . "/", $repo_path);
}
$object_base = is_file($repo_path) ? 'file' : (is_dir($repo_path) ? 'directory' : '');
if (!empty($object_base) && fn_copy($repo_path, $file_path)) {
fn_set_notification('N', __('notice'), __("text_{$object_base}_restored", array("[{$object_base}]" => fn_basename($file_path))));
Tygh::$app['ajax']->assign('content', fn_get_contents($file_path));
$copied = true;
}
}
if (!$copied) {
$object_base = empty($object_base) ? 'file' : $object_base;
fn_set_notification('E', __('error'), __("text_cannot_restore_{$object_base}", array("[{$object_base}]" => fn_basename($file_path))));
}
return array(CONTROLLER_STATUS_REDIRECT, 'templates.init_view?dir=' . $_REQUEST['file_path'] . '/' . $_REQUEST['file']);
}
/**
* Checks if working path is inside root directory
* @param string $path working path
* @return boolean true of success, false - otherwise
*/
function fn_te_check_path($path)
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:templates.php
示例18: fn_get_image_size
/**
* Returns image width, height, mime type and local path to image
*
* @param string $file path to image
* @return array array with width, height, mime type and path
*/
function fn_get_image_size($file)
{
// File is url, get it and store in temporary directory
if (strpos($file, '://') !== false) {
$tmp = fn_create_temp_file();
if (fn_put_contents($tmp, fn_get_contents($file)) == 0) {
return false;
}
$file = $tmp;
}
list($w, $h, $t, $a) = @getimagesize($file);
if (empty($w)) {
return false;
}
$t = image_type_to_mime_type($t);
return array($w, $h, $t, $file);
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:23,代码来源:fn.images.php
示例19: fn_basename
$image_path = 'sess_data/' . fn_basename($_REQUEST['image']);
if (Storage::instance('custom_files')->isExist($image_path)) {
$real_path = Storage::instance('custom_files')->getAbsolutePath($image_path);
list(, , $image_type, $tmp_path) = fn_get_image_size($real_path);
if ($type == 'T') {
$thumb_path = $image_path . '_thumb';
if (!Storage::instance('custom_files')->isExist($thumb_path)) {
// Output a thumbnail image
list($cont, $format) = fn_resize_image($tmp_path, Registry::get('settings.Thumbnails.product_lists_thumbnail_width'), Registry::get('settings.Thumbnails.product_lists_thumbnail_height'), Registry::get('settings.Thumbnails.thumbnail_background_color'));
if (!empty($cont)) {
Storage::instance('custom_files')->put($thumb_path, array('contents' => $cont));
}
}
$real_path = Storage::instance('custom_files')->getAbsolutePath($thumb_path);
}
header('Content-type: ' . $image_type);
fn_echo(fn_get_contents($real_path));
exit;
}
// Not image file. Display spacer instead.
header('Content-type: image/gif');
readfile(fn_get_theme_path('[themes]/[theme]') . '/media/images/spacer.gif');
exit;
} elseif ($mode == 'thumbnail') {
$img = fn_generate_thumbnail($_REQUEST['image_path'], $_REQUEST['w'], $_REQUEST['h']);
if (!empty($img)) {
header('Content-type: ' . fn_get_file_type($img));
fn_echo(fn_get_contents($img));
}
exit;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:31,代码来源:image.php
示例20: changes
/**
* Makes diff between original and latest snapshots
* @param array $params $_REQUEST params
* @return array array with changed data
*/
public static function changes($params)
{
$results = array();
$creation_time = 0;
$changes_tree = array();
$db_diff = '';
$db_d_diff = '';
$dist_filename = self::getName('dist');
$snapshot_filename = self::getName('current');
if (is_file($dist_filename)) {
if (is_file($snapshot_filename)) {
include $snapshot_filename;
include $dist_filename;
list($added, $changed, $deleted) = self::diff($snapshot, $snapshot_dist);
foreach ($snapshot['themes'] as $theme_name => $data) {
$data_dist = self::buildTheme($theme_name, $snapshot_dist);
list($theme_added, $theme_changed, $theme_deleted) = self::diff($data, $data_dist);
self::arrayMerge($added, $theme_added);
self::arrayMerge($changed, $theme_changed);
self::arrayMerge($deleted, $theme_deleted);
}
$tree = self::buildTree(array('added' => $added, 'changed' => $changed, 'deleted' => $deleted));
$tables = db_get_fields('SHOW TABLES');
$creation_time = $snapshot['time'];
$changes_tree = $tree;
if (!empty($snapshot_dist['db_scheme'])) {
$db_scheme = '';
foreach ($tables as $table) {
if (!in_array($table, $snapshot_dist['db_tables'])) {
continue;
}
$db_scheme .= "\nDROP TABLE IF EXISTS `" . $table . "`;\n";
$__scheme = db_get_row("SHOW CREATE TABLE {$table}");
$__scheme = array_pop($__scheme);
$replaced_scheme = preg_replace('/ AUTO_INCREMENT=[0-9]*/i', '', $__scheme);
if (!empty($replaced_scheme) && is_string($replaced_scheme)) {
$__scheme = $replaced_scheme;
}
$db_scheme .= $__scheme . ";";
}
$db_scheme = str_replace('default', 'DEFAULT', $db_scheme);
$snapshot_dist['db_scheme'] = str_replace('default', 'DEFAULT', $snapshot_dist['db_scheme']);
$db_diff = self::textDiff($snapshot_dist['db_scheme'], $db_scheme);
}
if (isset($params['db_ready']) && $params['db_ready'] == 'Y') {
$snapshot_dir = Registry::get('config.dir.snapshots');
$s_r = fn_get_contents($snapshot_dir . 'cmp_release.sql');
$s_c = fn_get_contents($snapshot_dir . 'cmp_current.sql');
@ini_set('memory_limit', '255M');
$db_d_diff = self::textDiff($s_r, $s_c);
}
}
$dist_filename = '';
}
return array('creation_time' => $creation_time, 'changes_tree' => $changes_tree, 'db_diff' => $db_diff, 'db_d_diff' => $db_d_diff, 'dist_filename' => $dist_filename);
}
开发者ID:askzap,项目名称:ultimate,代码行数:61,代码来源:Snapshot.php
注:本文中的fn_get_contents函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论