当前位置: 首页>>代码示例>>PHP>>正文


PHP WindFile::savePhpData方法代码示例

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


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

示例1: writeInstallLog

 /**
  * 写log
  *
  * @param string $logfile        	
  * @param array $data        	
  * @param boolean $additional        	
  */
 public static function writeInstallLog($logfile, $data, $additional = false)
 {
     if ($additional) {
         $_data = self::readInstallLog($logfile);
         if ($_data) {
             $data = array_merge($_data, $data);
         }
     }
     return WindFile::savePhpData($logfile, $data);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:17,代码来源:PwApplicationHelper.php

示例2: dbAction

 /**
  * step 6 : 数据库更新操作
  *
  * 先执行update.sql,再跳转到update.php
  */
 public function dbAction()
 {
     $step = (int) Wekit::cache()->get('system_upgrade_db_step');
     $step || $this->installService->after($this->localFileList, Wekit::cache()->get('system_upgrade_ftp'), $this->fileList);
     $sqlFile = Wind::getRealPath('PUBLIC:update.sql', true);
     $success = 1;
     if (!file_exists($sqlFile)) {
         Wekit::cache()->set('system_upgrade_step', 6);
         PwSystemHelper::log('no db update', $this->version);
         $this->forwardRedirect(WindUrlHelper::createUrl('appcenter/upgrade/php'));
     }
     $lang = Wind::getComponent('i18n');
     try {
         /* @var $db WindConnection */
         $db = Wind::getComponent('db');
         if (!$step) {
             $sqlArray = PwSystemHelper::sqlParser(WindFile::read($sqlFile), $db->getConfig('charset', '', 'utf8'), $db->getTablePrefix(), $db->getConfig('engine', '', 'MYISAM'));
             WindFile::savePhpData(DATA_PATH . 'upgrade/sql.tmp', $sqlArray);
         } else {
             $sqlArray = (include DATA_PATH . 'upgrade/sql.tmp');
         }
         end($sqlArray);
         if ($step > key($sqlArray)) {
             Wekit::cache()->set('system_upgrade_step', 6);
             PwSystemHelper::log('db update success', $this->version);
             $this->forwardRedirect(WindUrlHelper::createUrl('appcenter/upgrade/php'));
         }
         $sql = $sqlArray[$step];
         if ($sql) {
             foreach ($sql as $v) {
                 if (empty($v)) {
                     continue;
                 }
                 if (preg_match('/^ALTER\\s+TABLE\\s+`?(\\w+)`?\\s+(DROP|ADD)\\s+(KEY|INDEX|UNIQUE)\\s+([\\w\\(\\),`]+)?/i', $v, $matches)) {
                     list($key, $fields) = explode('(', $matches[4]);
                     $fields = trim($fields, '),');
                     list($matches[3]) = explode(' ', $matches[3]);
                     $matches[3] = trim(strtoupper($matches[3]));
                     PwSystemHelper::log($matches[1] . ' ' . str_replace('`', '', $key) . ' ' . ($fields ? str_replace('`', '', $fields) : '') . ' ' . $matches[3], $this->version);
                     PwSystemHelper::alterIndex(array($matches[1], str_replace('`', '', $key), $fields ? str_replace('`', '', $fields) : '', $matches[3], $matches[2]), $db);
                 } elseif (preg_match('/^ALTER\\s+TABLE\\s+`?(\\w+)`?\\s+(CHANGE|DROP|ADD)\\s+`?(\\w+)`?/i', $v, $matches)) {
                     PwSystemHelper::log($matches[1] . ' ' . $matches[3], $this->version);
                     PwSystemHelper::alterField(array($matches[1], $matches[3], $v), $db);
                 } else {
                     PwSystemHelper::log('execute sql ' . $v, $this->version);
                     $db->execute($v);
                 }
             }
         }
     } catch (Exception $e) {
         if ($e instanceof WindForwardException) {
             throw $e;
         }
         $success = 0;
         $this->setOutput(1, 'error');
         PwSystemHelper::log('execute sql failed' . $e->getMessage(), $this->version);
         $this->setOutput($lang->getMessage('APPCENTER:upgrade.db.error', array(implode(';', $sql))), 'msg');
     }
     if ($success) {
         $this->setOutput($lang->getMessage('APPCENTER:upgrade.db.update', array($step, key($sqlArray))), 'msg');
     }
     Wekit::cache()->set('system_upgrade_db_step', ++$step);
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:68,代码来源:UpgradeController.php

示例3: updateCache

 /**
  * 更新缓存
  * 
  * @return boolean
  */
 public function updateCache()
 {
     $data = $this->_getWindidAreaDs()->fetchAll();
     $file = Wind::getRealPath('DATA:area.area.php', true);
     WindFolder::mk(dirname($file));
     WindFile::savePhpData($file, $data, true);
     return $data;
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:13,代码来源:WindidAreaService.php

示例4: buildThreeArea

 protected function buildThreeArea()
 {
     $fileTmp = WindSecurity::escapePath(Wind::getRealDir('DATA:') . 'tmp/' . 'area.php');
     file_exists($fileTmp) && (self::$_map = (include $fileTmp));
     if (!self::$_map) {
         $area = $this->_getAreaDs()->fetchAll();
         foreach ($area as $key => $value) {
             if ($value['parentid'] < 100) {
                 continue;
             }
             self::$_map[] = $value['areaid'];
         }
         WindFile::savePhpData($fileTmp, self::$_map);
     }
     return self::$_map;
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:16,代码来源:ManageController.php

示例5: explode

            $pic_ids = explode("|", $pic_link_ups);
            foreach ($pic_ids as $k => $v) {
                if ($v) {
                    if ($_FILES['up_pic_' . $v]['error'] == 0) {
                        $rand = date("YmdHis") . random(3, $numeric = 1);
                        $filetype = array("jpg", "JPG", "jpeg", "JPEG", "gif", "GIF", "png", "PNG");
                        $arr = explode(".", $_FILES['up_pic_' . $v]["name"]);
                        $hz = $arr[count($arr) - 1];
                        $filepath = "source/plugin/dz55625_haodian/upimg/" . date("Ymd") . "/";
                        $randname = date("Y") . date("m") . date("d") . date("H") . date("i") . date("s") . rand(100, 999) . "." . $hz;
                        if (!file_exists($filepath)) {
                            mkdir($filepath);
                        }
                        if (@copy($_FILES['up_pic_' . $v]['tmp_name'], $filepath . $randname) || function_exists('move_uploaded_file') && @move_uploaded_file($_FILES['up_pic_' . $v]['tmp_name'], $filepath . $randname)) {
                            @unlink($_FILES['up_pic_' . $v]['tmp_name']);
                        }
                        $pic = "source/plugin/dz55625_haodian/upimg/" . date("Ymd") . "/" . $randname . "";
                        new myThumbClass($pic, 308, 180, $pic, 0, 0);
                        $conf['magic_lantern'][$v]['pic'] = $pic;
                    } else {
                        unset($conf['magic_lantern'][$v]['link']);
                    }
                }
            }
        }
        WindFile::savePhpData($file, $conf);
        cpmsg($php_lang['lbianjiok'], $appurl);
    } else {
        cpmsg($php_lang['czerror'], $appurl);
    }
}
开发者ID:edmundwong,项目名称:V604,代码行数:31,代码来源:wap_setting.inc.php

示例6: doRunAction

 /**
  * 应用的设置提交
  *
  */
 public function doRunAction()
 {
     $conf = $this->getInput('conf', 'post');
     WindFile::savePhpData($this->file, $conf);
     $this->showMessage('success');
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:10,代码来源:ManageController.php

示例7: _writeWindid

 /**
  * windid更新
  * 
  * @return boolean
  */
 private function _writeWindid()
 {
     $baseUrl = Wind::getApp()->getRequest()->getBaseUrl(true);
     $key = md5(WindUtility::generateRandStr(10));
     $charset = Wind::getApp()->getResponse()->getCharset();
     $charset = str_replace('-', '', strtolower($charset));
     if (!in_array($charset, array('gbk', 'utf8', 'big5'))) {
         $charset = 'utf8';
     }
     Wind::import('WINDID:service.app.dm.WindidAppDm');
     $dm = new WindidAppDm();
     $dm->setApiFile('windid.php')->setIsNotify('1')->setIsSyn('1')->setAppName('phpwind9.0')->setSecretkey($key)->setAppUrl($baseUrl)->setCharset($charset)->setAppIp('');
     $result = Windid::load('app.WindidApp')->addApp($dm);
     if ($result instanceof WindidError) {
         $this->showError('INSTALL:windid.init.fail');
     }
     $config = array('windid' => 'local', 'serverUrl' => $baseUrl, 'clientId' => (int) $result, 'clientKey' => $key, 'clientDb' => 'mysql', 'clientCharser' => $charset);
     WindFile::savePhpData(Wind::getRealPath('ROOT:conf.windidconfig.php', true), $config);
     return true;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:25,代码来源:UpgradeController.php

示例8: deleteValue

 protected function deleteValue($key)
 {
     return WindFile::savePhpData($key, '', 'w');
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:4,代码来源:PwFileCache.php

示例9: _writeFounder

 /**
  * 创建创始人
  *
  * @param string $manager
  * @param string $manager_pwd
  * @param string $manager_email
  * @return PwError
  */
 private function _writeFounder($manager, $manager_pwd, $manager_email)
 {
     Wekit::C()->reload('windid');
     Wind::import('SRV:user.dm.PwUserInfoDm');
     $data = array($manager => md5($manager_pwd));
     WindFile::savePhpData($this->_getFounderFile(), $data);
     //TODO 创始人添加:用户的配置信息先更新。添加完之后再更新回 开始
     $config = new PwConfigSet('register');
     $config->set('security.username.max', 15)->set('security.ban.username', '')->set('security.username.min', 1)->set('security.password.max', 25)->set('security.password.min', 1)->flush();
     Wind::import('WINDID:service.config.srv.WindidConfigSet');
     $windidConfig = new WindidConfigSet('reg');
     $windidConfig->set('security.ban.username', '')->set('security.password.max', 25)->set('security.password.min', 1)->set('security.username.max', 15)->set('security.username.min', 1)->flush();
     Wekit::C()->reload('register');
     WindidApi::C()->reload('reg');
     //TODO结束
     $userDm = new PwUserInfoDm();
     $userDm->setUsername($manager)->setPassword($manager_pwd)->setEmail($manager_email)->setGroupid(3)->setRegdate(Pw::getTime())->setLastvisit(Pw::getTime())->setRegip(Wind::getApp()->getRequest()->getClientIp())->setGroups(array('3' => '0'));
     //特殊操作  gao.wanggao
     if (true !== ($result = $userDm->beforeAdd())) {
         $this->showError($result->getError());
     }
     if (($uid = Wekit::load('WSRV:user.WindidUser')->addUser($userDm->dm)) < 1) {
         $this->showError('WINDID:code.' . $uid);
     }
     $userDm->setUid($uid);
     Wind::import('SRV:user.PwUser');
     $daoMap = array();
     $daoMap[PwUser::FETCH_MAIN] = 'user.dao.PwUserDao';
     $daoMap[PwUser::FETCH_DATA] = 'user.dao.PwUserDataDao';
     $daoMap[PwUser::FETCH_INFO] = 'user.dao.PwUserInfoDao';
     Wekit::loadDaoFromMap(PwUser::FETCH_ALL, $daoMap, 'PwUser')->addUser($userDm->getSetData());
     //特殊操作
     //$uid = Wekit::load('user.PwUser')->addUser($userDm);
     //TODO 创始人添加完成:恢复默认数据:开始
     $config = new PwConfigSet('register');
     $config->set('security.username.max', 15)->set('security.ban.username', '创始人,管理员,版主,斑竹,admin')->set('security.username.min', 3)->set('security.password.max', 15)->set('security.password.min', 6)->flush();
     $windidConfig = new WindidConfigSet('reg');
     $windidConfig->set('security.ban.username', '创始人,管理员,版主,斑竹,admin')->set('security.password.max', 15)->set('security.password.min', 6)->set('security.username.max', 15)->set('security.username.min', 3)->flush();
     //TODO 结束
     if ($uid instanceof PwError) {
         $this->showError($uid->getError());
     }
     Wekit::load('user.PwUserBelong')->update($uid, array(3 => 0));
     //特殊操作  gao.wanggao
     $this->_defaultAvatar($uid);
     $this->_defaultAvatar(0);
     //特殊操作
     //Wekit::load('user.srv.PwUserService')->restoreDefualtAvatar($uid);//用户的默认头像需要设置
     //Wekit::load('user.srv.PwUserService')->restoreDefualtAvatar(0);//游客的默认头像需要设置
     //站点统计信息
     Wind::import('SRV:site.dm.PwBbsinfoDm');
     $dm = new PwBbsinfoDm();
     $dm->setNewmember($manager)->addTotalmember(1);
     Wekit::load('site.PwBbsinfo')->updateInfo($dm);
     return $uid;
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:64,代码来源:IndexController.php

示例10: updateFounder

 /**
  * 更新创始人信息
  * 
  * @return boolean PwError
  */
 private function updateFounder()
 {
     $r = WindFile::savePhpData($this->getFounderFilePath(), $this->_founder);
     return $r ? $r : new PwError('ADMIN:founder.file.write.fail');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:10,代码来源:AdminFounderService.php

示例11: dobackAction

 /**
  * 备份
  * 
  * @return void
  */
 public function dobackAction()
 {
     @set_time_limit(500);
     list($sizelimit, $compress, $start, $tableid, $step, $dirname) = $this->getInput(array('sizelimit', 'compress', 'start', 'tableid', 'step', 'dirname'));
     list($tabledb, $insertmethod, $tabledbname) = $this->getInput(array('tabledb', 'insertmethod', 'tabledbname'));
     //关闭站点
     $backupService = $this->_getBackupService();
     $tabledbTmpSaveDir = $backupService->getDataDir() . 'tmp/';
     $backupService->createFolder($tabledbTmpSaveDir);
     $tableid = intval($tableid);
     $tableid = $tableid ? $tableid : 0;
     $insertmethod = $insertmethod == 'extend' ? 'extend' : 'common';
     $sizelimit = $sizelimit ? $sizelimit : 2048;
     (!is_array($tabledb) || !$tabledb) && !$step && $this->showError('BACKUP:name.empty');
     // 读取保存的需要操作的表
     if (!$tabledb && $step) {
         $cachedTable = WindFile::read(WindSecurity::escapePath($tabledbTmpSaveDir . $tabledbname . '.tmp'));
         $tabledb = explode("|", $cachedTable);
     }
     !$dirname && ($dirname = $backupService->getDirectoryName());
     // 第一次临时保存需要操作的表
     if (!$step) {
         $config = new PwConfigSet('site');
         $siteState = Wekit::load('config.PwConfig')->getValues('site');
         WindFile::savePhpData(WindSecurity::escapePath($tabledbTmpSaveDir . tempSite . '.php'), $siteState['visit.state']);
         $config->set('visit.state', 2)->flush();
         $specialTables = array_intersect($backupService->getSpecialTables(), $tabledb);
         $tabledb = array_values(array_diff($tabledb, $backupService->getSpecialTables()));
         // 备份数据表结构
         // 备份特殊表结构和数据
         if ($specialTables) {
             $backupService->backupSpecialTable($specialTables, $dirname, $compress, $insertmethod);
         }
         if ($tabledb) {
             $backupService->backupTable($tabledb, $dirname, $compress);
             $tabledbname = 'cached_table_buckup';
             WindFile::write(WindSecurity::escapePath($tabledbTmpSaveDir . $tabledbname . '.tmp'), implode("|", $tabledb), 'wb');
         }
     }
     if (!$tabledb) {
         $this->showMessage(array('BACKUP:bakup_success', array('{path}' => $backupService->getSavePath() . $dirname)), 'admin/backup/backup/run');
     }
     // 保存数据
     $step = (!$step ? 1 : $step) + 1;
     $filename = $dirname . '/' . $dirname . '_' . ($step - 1) . '.sql';
     list($backupData, $tableid, $start, $totalRows) = $backupService->backupData($tabledb, $tableid, $start, $sizelimit, $insertmethod, $filename);
     $continue = $tableid < count($tabledb) ? true : false;
     $backupService->saveData($filename, $backupData, $compress);
     // 循环执行
     if ($continue) {
         $currentTableName = $tabledb[$tableid];
         $currentPos = $start + 1;
         $createdFileNum = $step - 1;
         $referer = 'admin/backup/backup/doback?' . "start={$start}&tableid={$tableid}&sizelimit={$sizelimit}&step={$step}&insertmethod={$insertmethod}&compress={$compress}&tabledbname={$tabledbname}&dirname={$dirname}";
         $this->showMessage(array('BACKUP:bakup_step', array('{currentTableName}' => $currentTableName, '{totalRows}' => $totalRows, '{currentPos}' => $currentPos, '{createdFileNum}' => $createdFileNum)), $referer, true);
     } else {
         //还原站点
         $siteState = (require_once WindSecurity::escapePath($tabledbTmpSaveDir . tempSite . '.php'));
         $config = new PwConfigSet('site');
         $config->set('visit.state', $siteState)->flush();
         unlink(WindSecurity::escapePath($tabledbTmpSaveDir . $tabledbname . '.tmp'));
         $this->showMessage(array('BACKUP:bakup_success', array('{path}' => $backupService->getSavePath() . $dirname)), 'admin/backup/backup/run');
     }
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:69,代码来源:BackupController.php


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