Example #1
0
function cloud_download($path, $type = '')
{
    $pars = _cloud_build_params();
    $pars['method'] = 'application.shipping';
    $pars['path'] = $path;
    $pars['type'] = $type;
    $pars['gz'] = function_exists('gzcompress') && function_exists('gzuncompress') ? 'true' : 'false';
    $headers = array('content-type' => 'application/x-www-form-urlencoded');
    $dat = cloud_request('http://v2.addons.we7.cc/gateway.php', $pars, $headers, 300);
    if (is_error($dat)) {
        return error(-1, '网络存在错误, 请稍后重试。' . $dat['message']);
    }
    if ($dat['content'] == 'success') {
        return true;
    }
    $ret = @json_decode($dat['content'], true);
    if (is_error($ret)) {
        return $ret;
    } else {
        return error(-1, '不能下载文件, 请稍后重试。');
    }
}
Example #2
0
/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
load()->func('file');
load()->model('cloud');
load()->func('communication');
if ($do == 'check') {
    $filetree = file_tree(IA_ROOT);
    $modify = array();
    $unknown = array();
    $lose = array();
    $pars = _cloud_build_params();
    $pars['method'] = 'application.build';
    $pars['extra'] = cloud_extra_data();
    $dat = cloud_request('http://v2.addons.we7.cc/gateway.php', $pars);
    $file = IA_ROOT . '/data/application.build';
    $ret = _cloud_shipping_parse($dat, $file);
    foreach ($ret['files'] as $value) {
        $clouds[$value['path']]['path'] = $value['path'];
        $clouds[$value['path']]['checksum'] = $value['checksum'];
    }
    foreach ($filetree as $filename) {
        $file = str_replace(IA_ROOT, '', $filename);
        $ignore_list = array(strpos($file, '/data/tpl/') === 0, substr($file, -8) == 'map.json', strpos($file, '/data/logs') === 0, strpos($file, '/attachment') === 0, $file == '/data/config.php', strpos($file, '/data') === 0 && substr($file, -4) == 'lock', strpos($file, '/app/themes/default') === 0, $file == '/framework/version.inc.php');
        if (in_array(true, $ignore_list)) {
            continue;
        }
        if (preg_match('/\\/addons\\/([a-zA-Z_0-9\\-]+)\\/.*/', $file, $match)) {
            $module = IA_ROOT . '/addons/' . $match[1];
            if (file_exists($module . '/map.json')) {
Example #3
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
$_W['page']['title'] = '云服务诊断 - 云服务';
$dos = array('display', 'testapi');
$do = in_array($do, $dos) ? $do : 'display';
if ($do == 'testapi') {
    load()->model('cloud');
    $starttime = microtime(true);
    $response = cloud_request('http://v2.addons.we7.cc');
    $endtime = microtime(true);
    message('请求接口成功,耗时 ' . round($endtime - $starttime, 5) . ' 秒', '', 'ajax');
} else {
    if (checksubmit()) {
        load()->model('setting');
        setting_save('', 'site');
        message('成功清除站点记录.', 'refresh');
    }
    if (checksubmit('updateserverip')) {
        load()->model('setting');
        if (!empty($_GPC['ip'])) {
            setting_save($_GPC['ip'], 'cloudip');
        } else {
            setting_save('', 'cloudip');
        }
        message('修改云服务ip成功.', 'refresh');
    }
    setting_load(array('site', 'cloudip'));
Example #4
0
function cloud_cron_remove($cron_id)
{
    $pars = _cloud_build_params();
    $pars['method'] = 'cron.remove';
    $pars['cron_id'] = $cron_id;
    $result = cloud_request(ADDONS_URL . '/gateway.php', $pars);
    return _cloud_cron_parse($result);
}
Example #5
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
$_W['page']['title'] = '云服务诊断 - 云服务';
$dos = array('display', 'testapi');
$do = in_array($do, $dos) ? $do : 'display';
if ($do == 'testapi') {
    load()->model('cloud');
    $starttime = microtime(true);
    $response = cloud_request('http://v2.addons.we7.cc', array(), array('ip' => $_GPC['ip']));
    $endtime = microtime(true);
    message('请求接口成功,耗时 ' . round($endtime - $starttime, 5) . ' 秒', '', 'ajax');
} else {
    if (checksubmit()) {
        load()->model('setting');
        setting_save('', 'site');
        message('成功清除站点记录.', 'refresh');
    }
    if (checksubmit('updateserverip')) {
        load()->model('setting');
        if (!empty($_GPC['ip'])) {
            setting_save(array('ip' => $_GPC['ip'], 'expire' => TIMESTAMP + 201600), 'cloudip');
        } else {
            setting_save(array(), 'cloudip');
        }
        message('修改云服务ip成功.', 'refresh');
    }
    if (empty($_W['setting']['site'])) {
Example #6
0
<?php

load()->func('file');
load()->model('cloud');
load()->func('communication');
if ($do == 'check') {
    $filetree = file_tree(IA_ROOT);
    $modify = array();
    $unknown = array();
    $lose = array();
    $pars = _cloud_build_params();
    $pars['method'] = 'application.build';
    $pars['extra'] = cloud_extra_data();
    $dat = cloud_request(ADDONS_URL . '/gateway.php', $pars);
    $file = IA_ROOT . '/data/application.build';
    $ret = _cloud_shipping_parse($dat, $file);
    foreach ($ret['files'] as $value) {
        $clouds[$value['path']]['path'] = $value['path'];
        $clouds[$value['path']]['checksum'] = $value['checksum'];
    }
    foreach ($filetree as $filename) {
        $file = str_replace(IA_ROOT, '', $filename);
        if (strpos($file, '/data/logs') === 0 || strpos($file, '/data/tpl') === 0 || strpos($file, '/attachment') === 0) {
            continue;
        }
        if (preg_match('/\\/addons\\/([a-zA-Z_0-9\\-]+)\\/.*/', $file, $match)) {
            $module = IA_ROOT . '/addons/' . $match[1];
            if (file_exists($module . '/map.json')) {
                $maps = file_get_contents($module . '/map.json');
                $maps = json_decode($maps, true);
                if (!empty($maps)) {
Example #7
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
$_W['page']['title'] = '云服务诊断 - 云服务';
$dos = array('display', 'testapi');
$do = in_array($do, $dos) ? $do : 'display';
if ($do == 'testapi') {
    load()->model('cloud');
    $starttime = microtime(true);
    $response = cloud_request(ADDONS_URL);
    $endtime = microtime(true);
    message('请求接口成功,耗时 ' . round($endtime - $starttime, 5) . ' 秒', '', 'ajax');
} else {
    if (checksubmit()) {
        load()->model('setting');
        setting_save('', 'site');
        message('成功清除站点记录.', 'refresh');
    }
    if (checksubmit('updateserverip')) {
        load()->model('setting');
        if (!empty($_GPC['ip'])) {
            setting_save($_GPC['ip'], 'cloudip');
        } else {
            setting_save('', 'cloudip');
        }
        message('修改云服务ip成功.', 'refresh');
    }
    if (empty($_W['setting']['site'])) {
Example #8
0
function cloud_cron_remove($cron_id)
{
    $pars = _cloud_build_params();
    $pars['method'] = 'cron.remove';
    $pars['cron_id'] = $cron_id;
    $result = cloud_request('http://v2.addons.we7.cc/gateway.php', $pars);
    return _cloud_cron_parse($result);
}