• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP waLog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中waLog的典型用法代码示例。如果您正苦于以下问题:PHP waLog类的具体用法?PHP waLog怎么用?PHP waLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了waLog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getUserData

 public function getUserData($token)
 {
     $url = self::API_URL . "users.get?uid={$token['user_id']}&fields=contacts,sex,bdate,timezone,photo_medium&access_token={$token['access_token']}";
     $response = $this->get($url, $status);
     if ($response && ($response = json_decode($response, true))) {
         if (isset($response['error'])) {
             waLog::log($this->getId() . ':' . $status . ': Error ' . $response['error']['error_code'] . " (" . $response['error']['error_msg'] . ')', 'auth.log');
             throw new waException($response['error']['error_msg'], $response['error']['error_code']);
         }
         $response = $response['response'][0];
         if ($response) {
             $data = array('source' => 'vkontakte', 'source_id' => $response['uid'], 'url' => "http://vk.com/id" . $response['uid'], 'name' => $response['first_name'] . " " . $response['last_name'], 'firstname' => $response['first_name'], 'lastname' => $response['last_name'], 'photo_url' => $response['photo_medium']);
             if (!empty($token['email'])) {
                 $data['email'] = $token['email'];
             }
             if ($response['home_phone']) {
                 $data['phone.home'] = $response['home_phone'];
             }
             if ($response['sex']) {
                 $data['sex'] = $response['sex'] == 2 ? 'm' : 'f';
             }
             if ($response['bdate']) {
                 $b = explode('.', $response['bdate']);
                 if (count($b) == 3) {
                     $data['birthday'] = $b[2] . '-' . $b[1] . '-' . $b[0];
                 }
             }
             return $data;
         }
     }
     waLog::log($this->getId() . ':' . $status . ': ' . "Can't get user info from VK API", 'auth.log');
     throw new waException("Can't get user info from VK API", $status ? $status : 500);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:33,代码来源:vkontakteAuth.class.php


示例2: execute

 public function execute()
 {
     ob_start();
     $app = $this->getApp();
     $app_settings_model = new waAppSettingsModel();
     $app_settings_model->set($app, 'cron_schedule', time());
     waFiles::create($this->getConfig()->getPath('log') . '/' . $app . '/');
     $log_file = "{$app}/cron.txt";
     $post_model = new blogPostModel();
     $params = array('datetime' => date("Y-m-d H:i:s"), 'status' => blogPostModel::STATUS_SCHEDULED);
     $posts_schedule = $post_model->select("id,blog_id,contact_id,status,datetime")->where('datetime <= s:datetime AND status=s:status', $params)->fetchAll();
     if ($posts_schedule) {
         foreach ($posts_schedule as $post) {
             try {
                 waLog::log("Attempt publishing post with id [{$post['id']}]", $log_file);
                 $data = array("status" => blogPostModel::STATUS_PUBLISHED);
                 waLog::log($post_model->updateItem($post['id'], $data, $post) ? "success" : "fail", $log_file);
             } catch (Exception $ex) {
                 waLog::log($ex->getMessage(), $log_file);
                 waLog::log($ex->getTraceAsString(), $log_file);
             }
         }
     }
     $action = __FUNCTION__;
     /**
      * @event cron_action
      * @param string $action
      * @return void
      */
     wa()->event('cron_action', $action);
     if ($log = ob_get_clean()) {
         waLog::log($log, $log_file);
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:34,代码来源:blogCronSchedule.cli.php


示例3: send

 /**
  * @param $to
  * @param $text
  * @param string $from - sender
  * @return bool|mixed
  */
 public function send($to, $text, $from = null)
 {
     try {
         $adapter = $this->getAdapter($from);
         $result = $adapter->send($to, $text, $from ? $from : $adapter->getOption('from'));
         return $result;
     } catch (waException $e) {
         waLog::log($e->getMessage(), 'sms.log');
         return false;
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:17,代码来源:waSMS.class.php


示例4: log

 protected function log($message, $level = self::LOG_WARNING)
 {
     static $path;
     if (!$path) {
         $path = wa()->getApp() . '-import-';
     }
     if ($level <= $this->log_level) {
         waLog::log($message, $path . 'common.log');
     } elseif (wa()->getConfig()->isDebug()) {
         waLog::log($message, $path . 'debug.log');
     }
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:12,代码来源:blogImportPluginTransport.class.php


示例5: __construct

 public function __construct(waSystem $system, $routes = array())
 {
     $this->system = $system;
     if (!$routes) {
         $routes = $this->system->getConfig()->getConfigFile('routing');
         if (!is_array($routes)) {
             waLog::log("Invalid or missed routing config file");
             $routes = array();
         }
     }
     $this->setRoutes($routes);
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:12,代码来源:waRouting.class.php


示例6: execute

 public function execute()
 {
     // counts to show in page header near app names
     $apps = $this->getUser()->getApps(false);
     $root_path = wa()->getConfig()->getRootPath();
     $app_settings_model = new waAppSettingsModel();
     foreach ($apps as $app_id => $app) {
         $class_name = $app_id . 'Config';
         if ($app_settings_model->get($app_id, 'update_time') && file_exists($root_path . '/wa-apps/' . $app_id . '/lib/config/' . $class_name . '.class.php')) {
             try {
                 $n = wa($app_id)->getConfig()->onCount();
                 if ($n !== null) {
                     $this->response[$app_id] = $n;
                 }
             } catch (Exception $ex) {
                 waLog::log($ex->__toString());
             }
         }
     }
     // cache counts in session
     wa()->getStorage()->write('apps-count', array_filter($this->response));
     /*
     // announcements
     $user = wa()->getUser();
     $am = new waAnnouncementModel();
     $data = $am->getByApps($user->getId(), array_keys($apps), $user['create_datetime']);
     $announcements = array();
     foreach ($data as $row) {
         // show no more than 1 message per application
         if (isset($announcements[$row['app_id']]) && count($announcements[$row['app_id']]) >= 1) {
             continue;
         }
         $announcements[$row['app_id']][] = waDateTime::format('datetime', $row['datetime']).': '.$row['text'];
     }
     
     if ($announcements) {
         $announcements_html = '';
         foreach ($announcements as $app_id => $texts) {
             $announcements_html .= '<a href="#" rel="'.$app_id.'" class="wa-announcement-close">'._ws('[close]').'</a><p>';
             $announcements_html .= implode('<br />', $texts);
             $announcements_html .= '</p>';
         }
         if ($announcements_html) {
             $announcements_html = '<div id="wa-announcement">'.$announcements_html.'</div>';
         }
         $this->response['__announce'] = $announcements_html;
     }
     */
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:49,代码来源:webasystBackendCount.controller.php


示例7: removeExtras

 protected function removeExtras($app_id, $extras_id)
 {
     try {
         $paths = array();
         if (strpos($app_id, 'wa-plugins/') !== 0) {
             try {
                 $plugin_instance = waSystem::getInstance($app_id)->getPlugin($extras_id);
                 if (!$plugin_instance) {
                     return false;
                 }
                 $plugin_instance->uninstall();
             } catch (Exception $ex) {
                 waLog::log($ex->getMessage(), 'installer.log');
             }
             $this->installer->updateAppPluginsConfig($app_id, $extras_id, null);
             //wa-apps/$app_id/plugins/$slug
             $paths[] = wa()->getAppPath("{$this->extras_type}/{$extras_id}", $app_id);
             $paths[] = wa()->getTempPath(null, $app_id);
             //wa-cache/temp/$app_id/
             $paths[] = wa()->getAppCachePath(null, $app_id);
             //wa-cache/apps/$app_id/
         } else {
             $type = str_replace('wa-plugins/', '', $app_id);
             $paths[] = wa()->getConfig()->getPath('plugins') . '/' . $type . '/' . $extras_id;
             //wa-plugins/$type/$extras_id
             $paths[] = wa()->getAppCachePath(null, $type . '_' . $extras_id);
             //wa-cache/apps/$app_id/
         }
         foreach ($paths as $path) {
             waFiles::delete($path, true);
         }
         return true;
     } catch (Exception $ex) {
         //TODO check config
         if (strpos($app_id, 'wa-plugins/') !== 0) {
             if (file_exists(reset($paths) . '/lib/plugin.php')) {
                 $this->installer->updateAppPluginsConfig($app_id, $extras_id, true);
             }
         }
         throw $ex;
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:42,代码来源:installerPluginsRemove.action.php


示例8: execute

 public function execute()
 {
     // close session
     wa()->getStorage()->close();
     // counts to show in page header near app names
     $apps = $this->getUser()->getApps(false);
     $root_path = wa()->getConfig()->getRootPath();
     $app_settings_model = new waAppSettingsModel();
     foreach ($apps as $app_id => $app) {
         $class_name = $app_id . 'Config';
         if ($app_settings_model->get($app_id, 'update_time') && file_exists($root_path . '/wa-apps/' . $app_id . '/lib/config/' . $class_name . '.class.php')) {
             try {
                 $n = wa($app_id)->getConfig()->onCount();
                 if ($n !== null) {
                     $this->response[$app_id] = $n;
                 }
             } catch (Exception $ex) {
                 waLog::log('Error ' . $ex->getCode() . ': ' . $ex->getMessage());
             }
         }
     }
     // cache counts in session
     wa()->getStorage()->write('apps-count', array_filter($this->response));
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:24,代码来源:webasystBackendCount.controller.php


示例9: run

 public function run($params = NULL)
 {
     $app = $this->getApp();
     $app_settings_model = new waAppSettingsModel();
     $app_settings_model->set($app, 'last_schedule_cron_time', time());
     waFiles::create($this->getConfig()->getPath('log') . '/' . $app . '/');
     $log_file = "{$app}/schedule.txt";
     $post_model = new blogPostModel();
     $params = array('datetime' => date("Y-m-d H:i:s"), 'status' => blogPostModel::STATUS_SCHEDULED);
     $posts_schedule = $post_model->select("id, blog_id, contact_id, status, datetime")->where('datetime <= s:datetime AND status=s:status', $params)->fetchAll();
     if ($posts_schedule) {
         foreach ($posts_schedule as $post) {
             try {
                 waLog::log("Attempt publishing post with id [{$post['id']}]", $log_file);
                 $data = array("status" => blogPostModel::STATUS_PUBLISHED, "datetime" => date("Y-m-d H:i:s"));
                 $r = $post_model->updateItem($post['id'], $data, $post);
                 waLog::log($r ? "success" : "fail", $log_file);
             } catch (Exception $ex) {
                 waLog::log($ex->getMessage(), $log_file);
                 waLog::log($ex->getTraceAsString(), $log_file);
             }
         }
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:24,代码来源:blogSchedule.cli.php


示例10: wa

// Create cli.php if not included in distr already
$path = wa()->getConfig()->getRootPath() . '/cli.php';
if (!file_exists($path)) {
    if ($fp = fopen($path, 'w')) {
        $content = <<<CLI
#!/usr/bin/php
<?php
require_once(dirname(__FILE__).'/wa-system/cli.php');

CLI;
        fwrite($fp, $content);
        fclose($fp);
    }
}
// Protect private dirs with .htaccess
$paths = array('log', 'cache', 'config', 'installer');
foreach ($paths as $path) {
    $path = waSystem::getInstance()->getConfig()->getPath($path);
    waFiles::protect($path);
}
// Insert data into tables
foreach (array('wa_country', 'wa_region') as $table) {
    if ($sql = @file_get_contents(dirname(__FILE__) . '/' . $table . '.sql')) {
        try {
            $m = new waModel();
            $m->exec($sql);
        } catch (Exception $e) {
            waLog::log('Unable to populate ' . $table . ': ' . $e->getMessage() . "\n" . $e->getTraceAsString());
        }
    }
}
开发者ID:Lazary,项目名称:webasyst,代码行数:31,代码来源:install.php


示例11: run

 /**
  * Execute SQL query
  *
  * @param string $sql
  * @param bool $unbuffer
  * @throws waDbException
  * @return resource
  */
 private function run($sql, $unbuffer = false)
 {
     $sql = trim($sql);
     $result = $this->adapter->query($sql);
     if (!$result) {
         $error = "Query Error\nQuery: " . $sql . "\nError: " . $this->adapter->errorCode() . "\nMessage: " . $this->adapter->error();
         $trace = debug_backtrace();
         $stack = "";
         $default = array('file' => 'n/a', 'line' => 'n/a');
         foreach ($trace as $i => $row) {
             $row = array_merge($row, $default);
             $stack .= $i . ". " . $row['file'] . ":" . $row['line'] . "\n" . (isset($row['class']) ? $row['class'] : '') . (isset($row['type']) ? $row['type'] : '') . $row['function'] . "()\n";
         }
         waLog::log($error . "\nStack:\n" . $stack, 'db.log');
         throw new waDbException($error, $this->adapter->errorCode());
     }
     return $result;
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:26,代码来源:waModel.class.php


示例12: error

 private function error($message)
 {
     $path = wa()->getConfig()->getPath('log');
     waFiles::create($path . '/shop/csvproducts.log');
     waLog::log($message, 'shop/csvproducts.log');
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:6,代码来源:shopCsvProductrun.controller.php


示例13: validate

 /**
  * Validate data
  *
  * @param array &$data
  * @param array $options
  *
  * @return array messages or empty array
  */
 public function validate(&$data, $options = array())
 {
     $messages = array();
     if ($data['blog_status'] != blogBlogModel::STATUS_PRIVATE) {
         if (!empty($data['id'])) {
             $url_validator = new blogSlugValidator(array('id' => $data['id']));
         } else {
             if (!empty($options['transliterate']) && !$data['url']) {
                 if ($data['title']) {
                     $data['url'] = blogHelper::transliterate($data['title']);
                 } else {
                     $data['url'] = $this->genUniqueUrl('');
                 }
             }
             $url_validator = new blogSlugValidator();
         }
         $url_validator->setSubject(blogSlugValidator::SUBJECT_POST);
         if (!$url_validator->isValid($data['url'])) {
             $messages['url'] = current($url_validator->getErrors());
             if ($url_validator->isError(blogSlugValidator::ERROR_REQUIRED) && ($data['id'] || !$data['id'] && $data['status'] == blogPostModel::STATUS_DRAFT)) {
                 $url = $this->select('url')->where('id = i:id', array('id' => $data['id']))->fetchField('url');
                 $data['url'] = $url ? $url : $this->genUniqueUrl($data['title']);
                 unset($messages['url']);
                 if (!$url_validator->isValid($data['url'])) {
                     $messages['url'] = current($url_validator->getErrors());
                 }
             } elseif (!empty($options['make'])) {
                 $data['url'] = $this->genUniqueUrl($data['url']);
                 unset($messages['url']);
                 if (!$url_validator->isValid($data['url'])) {
                     $messages['url'] = current($url_validator->getErrors());
                 }
             }
         }
     } else {
         if (empty($data['id'])) {
             $data['url'] = $this->genUniqueUrl(empty($data['url']) ? $data['title'] : $data['url']);
         } else {
             $url = $this->select('url')->where('id = i:id', array('id' => $data['id']))->fetchField('url');
             $data['url'] = $url ? $url : $this->genUniqueUrl($data['title']);
         }
     }
     if (isset($data['datetime']) && !is_null($data['datetime'])) {
         if (!empty($options['datetime'])) {
             $formats = (array) $options['datetime'];
         } elseif (isset($options['datetime'])) {
             $formats = array();
         } elseif (strpos($data['datetime'], ':') !== false) {
             $formats = array('fulldatetime', 'datetime');
         } else {
             $formats = array('date');
         }
         if ($data['datetime'] != '') {
             $datetime = $data['datetime'];
             foreach ($formats as $format) {
                 try {
                     if ($datetime = waDateTime::parse($format, $data['datetime'])) {
                         break;
                     }
                 } catch (Exception $ex) {
                     $messages['datetime'] = _w('Incorrect format');
                     waLog::log($ex->getMessage());
                 }
             }
             if (preg_match('/^([\\d]{4})\\-([\\d]{1,2})\\-([\\d]{1,2})(\\s|$)/', $datetime, $matches)) {
                 if (!checkdate($matches[2], $matches[3], $matches[1])) {
                     $messages['datetime'] = _w('Incorrect format');
                 }
             }
             $data['datetime'] = $datetime;
         } else {
             if ($data['status'] != blogPostModel::STATUS_DRAFT) {
                 $data['datetime'] = false;
             }
         }
         if ($data['datetime'] === false) {
             $messages['datetime'] = _w('Incorrect format');
         }
     }
     /**
      * @event post_validate
      * @param array [string]mixed $data
      * @param array ['plugin']['%plugin_id%']mixed plugin data
      * @return array['%plugin_id%']['field']string error
      */
     $messages['plugin'] = wa()->event('post_validate', $data);
     if (empty($messages['plugin'])) {
         unset($messages['plugin']);
     }
     return $messages;
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:99,代码来源:blogPost.model.php


示例14: array

<?php

$sqls = array();
$sqls[] = 'ALTER TABLE  `blog_comment` CHANGE  `email`  `email` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL';
$sqls[] = 'ALTER TABLE  `blog_comment` CHANGE  `name`  `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL';
$sqls[] = 'ALTER TABLE  `blog_comment` CHANGE  `site`  `site` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL';
$sqls[] = 'ALTER TABLE  `blog_post` CHANGE  `text`  `text` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL';
$model = new waModel();
foreach ($sqls as $sql) {
    try {
        $model->exec($sql);
    } catch (Exception $ex) {
        if (class_exists('waLog')) {
            waLog::log(basename(__FILE__) . ': ' . $ex->getMessage(), 'blog-update.log');
        }
    }
}
开发者ID:Lazary,项目名称:webasyst,代码行数:17,代码来源:1337009256.php


示例15: log

 protected static function log($module_id, $data)
 {
     $module_id = strtolower($module_id);
     $filename = 'payment/' . $module_id . 'Payment.log';
     $rec = "data:\n";
     if (is_array($data)) {
         foreach ($data as $key => $val) {
             $rec .= "{$key}={$val}&\n";
         }
     } else {
         $rec .= "{$data}\n";
     }
     waLog::log($rec, $filename);
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:14,代码来源:waPayment.class.php


示例16: duplicate


//.........这里部分代码省略.........
             $product_pages_model->add($page);
         }
     }
     #duplicate images
     $product_skus_model = new shopProductSkusModel();
     $images_model = new shopProductImagesModel();
     $images = $images_model->getByField('product_id', $this->getId(), $images_model->getTableId());
     $callback = create_function('$a, $b', 'return (max(-1, min(1, $a["sort"] - $b["sort"])));');
     usort($images, $callback);
     foreach ($images as $id => $image) {
         $source_path = shopImage::getPath($image);
         $original_file = shopImage::getOriginalPath($image);
         $image['product_id'] = $duplicate->getId();
         if ($sku_id = array_search($image['id'], $sku_images)) {
             $sku_id = $sku_map[$sku_id];
         }
         unset($image['id']);
         try {
             if ($image['id'] = $images_model->add($image, $id == $this->image_id)) {
                 waFiles::copy($source_path, shopImage::getPath($image));
                 if (file_exists($original_file)) {
                     waFiles::copy($original_file, shopImage::getOriginalPath($image));
                 }
                 if ($sku_id) {
                     $product_skus_model->updateById($sku_id, array('image_id' => $image['id']));
                 }
                 if (!$image_thumbs_on_demand) {
                     shopImage::generateThumbs($image, $config->getImageSizes());
                     //TODO use dummy copy  with rename files
                 }
             }
         } catch (waDbException $ex) {
             //just ignore it
             waLog::log('Error during copy product: ' . $ex->getMessage(), 'shop.log');
         } catch (waException $ex) {
             if (!empty($image['id'])) {
                 $images_model->deleteById($image['id']);
             }
             waLog::log('Error during copy product: ' . $ex->getMessage(), 'shop.log');
         }
     }
     foreach ($sku_files as $sku_id => $data) {
         $source_path = $data['file_path'];
         unset($data['file_path']);
         $sku_id = $sku_map[$sku_id];
         $sku = array_merge($duplicate->skus[$sku_id], $data);
         $product_skus_model->updateById($sku_id, $data);
         $target_path = shopProductSkusModel::getPath($sku);
         try {
             waFiles::copy($source_path, $target_path);
         } catch (waException $ex) {
             $data = array('file_name' => '', 'file_description' => '', 'file_size' => 0);
             $product_skus_model->updateById($sku_id, $data);
             print $ex->getMessage();
         }
     }
     $product_features_model = new shopProductFeaturesModel();
     $skus_features = $product_features_model->getSkuFeatures($this->id);
     $skus_features_data = array();
     foreach ($skus_features as $sku_id => $features) {
         $sku_id = $sku_map[$sku_id];
         foreach ($features as $feature_id => $feature_value_id) {
             $skus_features_data[] = compact('product_id', 'sku_id', 'feature_id', 'feature_value_id');
         }
     }
     if ($skus_features_data) {
开发者ID:Lazary,项目名称:webasyst,代码行数:67,代码来源:shopProduct.class.php


示例17: execute

 public function execute()
 {
     $id = waRequest::post('id', null, waRequest::TYPE_INT);
     if (!$id) {
         throw new waException("Can't rotate photo");
     }
     $direction = waRequest::post('direction', 'left', waRequest::TYPE_STRING_TRIM);
     if (isset($this->derection_angles[$direction])) {
         $photo_model = new photosPhotoModel();
         $photo_rights_model = new photosPhotoRightsModel();
         $photo = $photo_model->getById($id);
         if (!$photo_rights_model->checkRights($photo, true)) {
             throw new waException(_w("You don't have sufficient access rights"));
         }
         $photo_path = photosPhoto::getPhotoPath($photo);
         $paths = array();
         try {
             $image = new photosImage($photo_path);
             $result_photo_path = preg_replace('/(\\.[^\\.]+)$/', '.result$1', $photo_path);
             $backup_photo_path = preg_replace('/(\\.[^\\.]+)$/', '.backup$1', $photo_path);
             $paths[] = $result_photo_path;
             $result = $image->rotate($this->derection_angles[$direction])->save($result_photo_path);
             if ($result) {
                 $count = 0;
                 while (!file_exists($result_photo_path) && ++$count < 5) {
                     sleep(1);
                 }
                 if (!file_exists($result_photo_path)) {
                     throw new waException("Error while rotate. I/O error");
                 }
                 $paths[] = $backup_photo_path;
                 if (waFiles::move($photo_path, $backup_photo_path)) {
                     if (!waFiles::move($result_photo_path, $photo_path)) {
                         if (!waFiles::move($backup_photo_path, $photo_path)) {
                             throw new waException("Error while rotate. Original file corupted but backuped");
                         }
                         throw new waException("Error while rotate. Operation canceled");
                     } else {
                         $edit_datetime = date('Y-m-d H:i:s');
                         $data = array('edit_datetime' => $edit_datetime, 'width' => $photo['height'], 'height' => $photo['width']);
                         $photo_model->updateById($id, $data);
                         $photo = array_merge($photo, $data);
                         $thumb_dir = photosPhoto::getPhotoThumbDir($photo);
                         $back_thumb_dir = preg_replace('@(/$|$)@', '.back$1', $thumb_dir, 1);
                         $paths[] = $back_thumb_dir;
                         waFiles::delete($back_thumb_dir);
                         if (!(waFiles::move($thumb_dir, $back_thumb_dir) || waFiles::delete($back_thumb_dir)) && !waFiles::delete($thumb_dir)) {
                             throw new waException("Error while rebuild thumbnails");
                         }
                     }
                     $photo['thumb'] = photosPhoto::getThumbInfo($photo, photosPhoto::getThumbPhotoSize());
                     $photo['thumb_big'] = photosPhoto::getThumbInfo($photo, photosPhoto::getBigPhotoSize());
                     $photo['thumb_middle'] = photosPhoto::getThumbInfo($photo, photosPhoto::getMiddlePhotoSize());
                     $original_photo_path = photosPhoto::getOriginalPhotoPath($photo);
                     if (wa('photos')->getConfig()->getOption('save_original') && file_exists($original_photo_path)) {
                         $photo['original_exists'] = true;
                     } else {
                         $photo['original_exists'] = false;
                     }
                     $this->response['photo'] = $photo;
                     $this->log('photo_edit', 1);
                     $obligatory_sizes = $this->getConfig()->getSizes();
                     try {
                         photosPhoto::generateThumbs($photo, $obligatory_sizes);
                     } catch (Exception $e) {
                         waLog::log($e->getMessage());
                     }
                 } else {
                     throw new waException("Error while rotate. Operation canceled");
                 }
             }
             foreach ($paths as $path) {
                 waFiles::delete($path);
             }
         } catch (Exception $e) {
             foreach ($paths as $path) {
                 waFiles::delete($path);
             }
             throw $e;
         }
     }
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:82,代码来源:photosPhotoRotate.controller.php


示例18: checkUpdates

 protected function checkUpdates()
 {
     try {
         $app_settings_model = new waAppSettingsModel();
         $time = $app_settings_model->get($this->application, 'update_time');
     } catch (waDbException $e) {
         if ($e->getCode() == 2002 && !waSystemConfig::isDebug()) {
             return;
         } else {
             // table doesn't exist
             $time = null;
         }
     } catch (waException $e) {
         return;
     }
     if (!$time) {
         try {
             $this->install();
         } catch (waException $e) {
             waLog::log($e->__toString());
             throw $e;
         }
         $ignore_all = true;
     } else {
         $ignore_all = false;
     }
     if (!self::isDebug()) {
         $cache = new waVarExportCache('updates', 0, $this->application);
         if ($cache->isCached() && $cache->get() <= $time) {
             return;
         }
     }
     $path = $this->getAppPath() . '/lib/updates';
     $cache_database_dir = $this->getPath('cache') . '/db';
     if (file_exists($path)) {
         $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
         $files = array();
         foreach ($iterator as $file) {
             /**
              * @var SplFileInfo $file
              */
             if ($file->isFile() && preg_match('/^[0-9]+\\.php$/', $file->getFilename())) {
                 $t = substr($file->getFilename(), 0, -4);
                 if ($t > $time) {
                     $files[$t] = $file->getPathname();
                 }
             }
         }
         ksort($files);
         if (!self::isDebug()) {
             // get last time
             if ($files) {
                 $keys = array_keys($files);
                 $cache->set(end($keys));
             } else {
                 $cache->set($time ? $time : 1);
             }
         }
         foreach ($files as $t => $file) {
             try {
                 if (!$ignore_all) {
                     include $file;
                     waFiles::delete($cache_database_dir);
                     $app_settings_model->set($this->application, 'update_time', $t);
                 }
             } catch (Exception $e) {
                 if (waSystemConfig::isDebug()) {
                     echo $e;
                 }
                 // log errors
                 waLog::log($e->__toString());
                 break;
             }
         }
     } else {
         $t = 1;
     }
     if ($ignore_all) {
         if (!isset($t) || !$t) {
             $t = 1;
         }
         if (!isset($app_settings_model)) {
             $app_settings_model = new waAppSettingsModel();
         }
         $app_settings_model->set($this->application, 'update_time', $t);
     }
     if (isset($this->info['edition']) && $this->info['edition']) {
         if (!isset($app_settings_model)) {
             $app_settings_model = new waAppSettingsModel();
         }
         if (!$app_settings_model->get($this->application, 'edition')) {
             $file_sql = $this->getAppPath('lib/config/app.' . $this->info['edition'] . '.sql');
             if (file_exists($file_sql)) {
                 self::executeSQL($file_sql, 1);
             }
             $app_settings_model->set($this->application, 'edition', $this->info['edition']);
         }
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:99,代码来源:waAppConfig.class.php


示例19: wa

<?php

//create first blog at install
try {
    $name = wa()->accountName();
    $blog = array('status' => blogBlogModel::STATUS_PUBLIC, 'name' => $name, 'icon' => 'blog', 'color' => 'b-white', 'url' => blogHelper::transliterate($name));
    $app = wa()->getApp();
    $blog_model = new blogBlogModel();
    if ($blog_model->countAll() == 0) {
        $blog_id = $blog_model->insert($blog);
        $user = wa()->getUser();
        if (!$user->isAdmin($app)) {
            $user->setRight($app, "blog.{$blog_id}", blogRightConfig::RIGHT_FULL);
        }
    }
} catch (Exception $e) {
    waLog::log($e->getMessage());
}
开发者ID:Lazary,项目名称:webasyst,代码行数:18,代码来源:install.php


示例20: save

 /**
  * Store settings at storage
  * @param bool $force
  * @return void
  */
 public function save($force = false)
 {
     $settingsChanged = $force ? $this->settingsChanged : array_fill_keys(array_keys($this->settings), true);
     $updated = false;
     if (is_array($settingsChanged)) {
         foreach ($settingsChanged as $name => &$changed) {
             if ($changed) {
                 $updated = true;
                 if (!isset($this->settingsParams[$name]) || !isset($this->settingsParams[$name]['settings_store']) || $this->settingsParams[$name]['settings_store'] == 'mysql') {
                     $value = $this->settings[$name];
                     if (is_object($value) && isset($this->settingsParams[$name]['settings_object'])) {
                         $class = get_class($value);
                         if (class_exists($class) && in_array('waSettingWrapper', class_parents($class))) {
                             $value = $value->store();
                         } else {
                             waLog::log(sprintf('Invalid setting class %s for setting %s at %s', get_class($value), $name, $this->name));
                         }
                     }
                     if (is_array($value)) {
                         //$value = serialize($value);
                         $value = json_encode($value);
                     }
                     $this->saveSetting($name, $value);
                 }
                 $changed = false;
             }
         }
     }
     if ($updated) {
         $this->flush();
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:37,代码来源:waSettings.class.php



注:本文中的waLog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP waModel类代码示例发布时间:2022-05-23
下一篇:
PHP waFiles类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap