本文整理汇总了PHP中main::log方法的典型用法代码示例。如果您正苦于以下问题:PHP main::log方法的具体用法?PHP main::log怎么用?PHP main::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::log方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
include main::getPluginDir() . '/libs/classes/aws-autoloader.php';
$ad = $this->params['access_details'];
main::log(lang::get('Start copy files to Amazon S3', false));
$files = $this->params['files'];
$dir = isset($ad['dir']) ? $ad['dir'] : '/';
$credentials = new Aws\Common\Credentials\Credentials($ad['AccessKeyId'], $ad['SecretAccessKey']);
$client = Aws\S3\S3Client::factory(array('credentials' => $credentials));
try {
$n = count($files);
for ($i = 0; $i < $n; $i++) {
$filePath = preg_replace('#[/\\\\]+#', '/', BACKUP_DIR . '/' . $dir . '/' . $files[$i]);
$key = $dir ? $dir . '/' . basename($filePath) : basename($filePath);
$key = ltrim(preg_replace('#[/\\\\]+#', '/', $key), '/');
//if first will be '/', file not will be uploaded, but result will be ok
$putRes = $client->putObject(array("Bucket" => $ad['bucket'], 'Key' => $key, 'Body' => fopen($filePath, 'r+')));
if (isset($putRes['RequestId']) && !empty($putRes['RequestId'])) {
main::log(str_replace('%s', basename($filePath), lang::get("File(%s) Upload successfully to Amazon S3", false)));
}
}
main::log(lang::get('End copy files to Amazon S3', false));
} catch (Exception $e) {
main::log('Error send to Amazon s3: ' . $e->getMessage());
$this->setError($e->getMessage());
return false;
} catch (S3Exception $e) {
main::log('Error send to Amazon s3: ' . $e->getMessage());
$this->setError($e->getMessage());
return false;
}
return true;
}
示例2: loadLibs
public static function loadLibs($libList)
{
foreach ($libList as $lib) {
$libFile = wm_lib_path . $lib;
if (!is_file($libFile)) {
main::log('ERROR', 'inexistent lib file: ' . $lib, true);
}
require $libFile;
}
}
示例3: __construct
function __construct($data)
{
if (!$data) {
main::log('ERROR', 'data not defined', true);
}
if (!is_array($data)) {
main::log('ERROR', 'data is not an array', true);
}
$this->data = $data;
}
示例4: local
private function local()
{
$this->files = readDirectrory(BACKUP_DIR . '/' . $this->params['name'], array('.zip'));
include main::getPluginDir() . '/libs/pclzip.lib.php';
if (($n = count($this->files)) > 0) {
for ($i = 0; $i < $n; $i++) {
main::log(str_replace('%s', basename($this->files[$i]), lang::get("Data decompression: %s", false)));
$this->archive = new PclZip($this->files[$i]);
$file_in_zip = $this->archive->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER);
}
if (file_exists(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql')) {
main::log(lang::get("Run process restore Database", false));
$mysql = $this->incMysql();
$mysql->restore(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql');
main::log(lang::get("Stopped process restore Database", false));
main::remove(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql');
}
}
}
示例5: header
header('Content Type: text/plain');
define('wm_absolute_path', dirname(__FILE__) . '/');
define('wm_lib_path', wm_absolute_path . 'lib/');
define('wm_acts_path', wm_absolute_path . 'acts/');
define('wm_templates_path', wm_absolute_path . 'templates/');
define('wm_log_path', wm_absolute_path . 'log/');
define('wm_db_file', wm_absolute_path . 'db.sqlite');
require wm_absolute_path . 'main.php';
require wm_absolute_path . 'template.php';
require wm_absolute_path . 'utils.php';
$inputData = trim(file_get_contents('php://input'));
if (!$inputData) {
main::log('ERROR', sprintf('[%s] no input data provided', $_SERVER['REMOTE_ADDR']), true);
}
$inputData = json_decode($inputData, true);
if (!($inputData && is_array($inputData))) {
main::log('ERROR', sprintf('[%s] invalid input data', $_SERVER['REMOTE_ADDR']), true);
}
if (!utils::keysOk($inputData, ['act', 'data'])) {
main::log('ERROR', sprintf('[%s] required keys not set', $_SERVER['REMOTE_ADDR']), true);
}
$act = $inputData['act'];
$data = $inputData['data'];
main::loadLibs(['sqliteDB/sqliteDB.class.php']);
main::initDB();
list($laBool, $laMsg) = main::loadAct($act);
if (!$laBool) {
main::log('ERROR', $lsMsg, true);
}
$actOb = new $act($data);
print_r($actOb->exec());
示例6: response
private function response($status, $message)
{
$message = sprintf('[%s] %s', 'ACT::ping', $message);
main::log($status, $message);
return main::response($status, $message, false, 'text/plain');
}
示例7: response
private function response($status, $message, $data = false, $cntType = 'text/plain')
{
$message = sprintf('[%s] %s', 'ACT::render', $message);
main::log($status, $message);
return main::response($status, $message, $data, $cntType);
}
示例8: restore
public function restore($file)
{
main::log(lang::get('Restore Database was started', false));
$fo = fopen($file, "r");
if (!$fo) {
main::log(lang::get('Error in open file dump', false));
$this->setError(lang::get('Error in open file dump', false));
return false;
}
$sql = "";
while (false !== ($char = fgetc($fo))) {
$sql .= $char;
if ($char == ";") {
$char_new = fgetc($fo);
if ($char_new !== false && $char_new != "\n") {
$sql .= $char_new;
} else {
$ress = $this->dbh->query($sql);
//$log = $this->parseMysql($sql);
if (!empty($log['message'])) {
main::log(lang::get(str_replace("%s", $log['table'], $log['message']), false));
}
if (!empty($this->dbh->last_error) && $n > 0) {
$this->setError($this->dbh->last_error);
main::log(lang::get('MySQL Error: ', false) . $this->dbh->last_error);
break;
}
$sql = "";
}
}
}
main::log(lang::get('Restore Database was finished', false));
}
示例9: createListFiles
private function createListFiles()
{
if (!empty($this->params['minus-path'])) {
$this->minus_path = explode(",", $this->params['minus-path']);
}
$files = array(ABSPATH . '.htaccess', ABSPATH . 'index.php', ABSPATH . 'license.txt', ABSPATH . 'readme.html', ABSPATH . 'wp-activate.php', ABSPATH . 'wp-blog-header.php', ABSPATH . 'wp-comments-post.php', ABSPATH . 'wp-config.php', ABSPATH . 'wp-config-sample.php', ABSPATH . 'wp-cron.php', ABSPATH . 'wp-links-opml.php', ABSPATH . 'wp-load.php', ABSPATH . 'wp-login.php', ABSPATH . 'wp-mail.php', ABSPATH . 'wp-settings.php', ABSPATH . 'wp-signup.php', ABSPATH . 'wp-trackback.php', ABSPATH . 'xmlrpc.php');
$folders = array(ABSPATH . 'wp-admin', ABSPATH . 'wp-content', ABSPATH . 'wp-includes');
if (!empty($this->params['plus-path'])) {
$plus_path = explode(",", $this->params['plus-path']);
foreach ($plus_path as $p) {
if (empty($p)) {
continue;
}
$p = ABSPATH . $p;
if (file_exists($p)) {
if (is_dir($p)) {
$folders[] = $p;
} else {
$files[] = $p;
}
}
}
}
$f = '';
foreach ($folders as $folder) {
if (!is_dir($folder)) {
continue;
}
$f = str_replace(ABSPATH, '', $folder);
if (in_array($f, $this->minus_path)) {
continue;
}
$files = array_merge($files, readDirectrory($folder));
}
$ret = array();
if (($n = count($files)) > 0) {
$f = '';
for ($i = 0; $i < $n; $i++) {
$f = str_replace(ABSPATH, '', $files[$i]);
if (!in_array($f, $this->minus_path) || strpos($f, 'cache') === false) {
$ret[] = $files[$i];
} else {
main::log(str_replace('%s', $f, lang::get('Skip file "%s"', false)));
}
}
}
return $files;
}
示例10: rwRulesBreakdown
private static function rwRulesBreakdown($parsedUrl, $rules)
{
$urlPath = trim($parsedUrl['path'], '/');
$urlData = [];
if (!$urlPath) {
return $urlData;
}
$urlArgs = explode('/', $urlPath);
for ($i = 0; $i < count($rules); $i++) {
if ($i >= count($urlArgs)) {
break;
}
$cRule = $rules[$i];
if (!is_array($cRule)) {
main::log('ERROR', sprintf('rewrite rule %d should be an object', $i), true);
}
if (count($cRule) != 1) {
main::log('ERROR', 'rewrite rule object should have one element', true);
}
$argName = array_keys($cRule)[0];
$argPattern = $cRule[$argName];
$cUrlArg = $urlArgs[$i];
preg_match($argPattern, $cUrlArg, $match);
if (!$match) {
main::log('ERROR', sprintf('URL argument %d "%s" does not match the pattern %s', $i + 1, $cUrlArg, $argPattern), true);
}
$urlData[$argName] = $cUrlArg;
}
return $urlData;
}