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


PHP FileDataManager::getDataPath方法代码示例

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


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

示例1: __construct

 public function __construct($session_started = false)
 {
     parent::__construct($session_started);
     $this->setViewTemplate('install.backup.tpl');
     $this->setPageTitle('Backup & Restore');
     $this->backup_file = FileDataManager::getDataPath('.htthinkup_db_backup.zip');
     // not in the backup dir itself
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:8,代码来源:class.BackupController.php

示例2: tearDown

 public function tearDown()
 {
     $this->builders = null;
     $test_email = FileDataManager::getDataPath(Mailer::EMAIL);
     if (file_exists($test_email)) {
         unlink($test_email);
     }
     parent::tearDown();
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:9,代码来源:WebTestOfForgottonPassword.php

示例3: tearDown

 public function tearDown()
 {
     parent::tearDown();
     // delete test email file if it exists
     $test_email = FileDataManager::getDataPath(Mailer::EMAIL);
     if (file_exists($test_email)) {
         unlink($test_email);
     }
 }
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:9,代码来源:TestOfMailer.php

示例4: getLastMail

 /**
  * Return the contents of the last email Mailer "sent" out.
  * For testing purposes only; this will return nothing in production.
  * @return str The contents of the last email sent
  */
 public static function getLastMail()
 {
     $test_email_file = FileDataManager::getDataPath(Mailer::EMAIL);
     if (file_exists($test_email_file)) {
         return file_get_contents($test_email_file);
     } else {
         return '';
     }
 }
开发者ID:kuthulas,项目名称:ProjectX,代码行数:14,代码来源:class.Mailer.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     new BackupMySQLDAO();
     $this->config = Config::getInstance();
     $this->pdo = BackupMySQLDAO::$PDO;
     $this->backup_file = FileDataManager::getDataPath('.htthinkup_db_backup.zip');
     $this->backup_test = FileDataManager::getDataPath('thinkup_db_backup_test.zip');
     $this->backup_dir = FileDataManager::getBackupPath() . '/';
 }
开发者ID:nix4,项目名称:ThinkUp,代码行数:10,代码来源:TestOfBackupController.php

示例6: tearDown

 public function tearDown()
 {
     parent::tearDown();
     $config = Config::getInstance();
     $config->setValue("mandrill_api_key", "");
     // delete test email file if it exists
     $test_email = FileDataManager::getDataPath(Mailer::EMAIL);
     if (file_exists($test_email)) {
         unlink($test_email);
     }
 }
开发者ID:jkuehl-carecloud,项目名称:ThinkUp,代码行数:11,代码来源:TestOfMailer.php

示例7: testGetDataPathConfigExistsWithDataDirValue

 public function testGetDataPathConfigExistsWithDataDirValue()
 {
     require THINKUP_WEBAPP_PATH . 'config.inc.php';
     //if test fails here, the config file doesn't have datadir_path set
     $this->assertNotNull($THINKUP_CFG['datadir_path']);
     //test just path
     $path = FileDataManager::getDataPath();
     $this->assertEqual($path, $THINKUP_CFG['datadir_path']);
     //test path with file
     $path = FileDataManager::getDataPath('myfile.txt');
     $this->assertEqual($path, $THINKUP_CFG['datadir_path'] . 'myfile.txt');
 }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:12,代码来源:TestOfFileDataManager.php

示例8: testViewManagerDefaultValues

 /**
  * Test default values
  */
 public function testViewManagerDefaultValues()
 {
     $cfg = Config::getInstance();
     $cfg->setValue('source_root_path', '/path/to/thinkup/');
     $cfg->setValue('cache_pages', true);
     $cfg->setValue('cache_lifetime', 600);
     $v_mgr = new ViewManager();
     $this->assertTrue(sizeof($v_mgr->template_dir), 2);
     $this->assertEqual($v_mgr->template_dir[1], '/path/to/thinkup/tests/view');
     $this->assertTrue(sizeof($v_mgr->plugins_dir), 2);
     $this->assertEqual($v_mgr->plugins_dir[0], 'plugins');
     $this->assertEqual($v_mgr->cache_dir, FileDataManager::getDataPath('compiled_view/cache'));
     $this->assertEqual($v_mgr->cache_lifetime, $cfg->getValue('cache_lifetime'));
     $this->assertTrue($v_mgr->caching);
 }
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:18,代码来源:TestOfViewManager.php

示例9: setUp

 public function setUp()
 {
     parent::setUp();
     new ExportMySQLDAO();
     $this->config = Config::getInstance();
     $this->pdo = ExportMySQLDAO::$PDO;
     $this->export_test = FileDataManager::getDataPath('thinkup_user_export_test.zip');
     $hashed_pass = ThinkUpTestLoginHelper::hashPasswordUsingDeprecatedMethod("secretpassword");
     $owner = array('id' => 1, 'email' => 'me@example.com', 'pwd' => $hashed_pass, 'is_activated' => 1, 'is_admin' => 1, 'pwd_salt' => OwnerMySQLDAO::$default_salt);
     $this->builders[] = FixtureBuilder::build('owners', $owner);
     $instance = array('id' => 1, 'network_username' => 'test_user', 'network' => 'twitter');
     $this->builders[] = FixtureBuilder::build('instances', $instance);
     $owner_instance = array('owner_id' => 1, 'instance_id' => 1);
     $this->builders[] = FixtureBuilder::build('owner_instances', $owner_instance);
     $this->builders[] = FixtureBuilder::build('users', array('user_id' => 10, 'network' => 'twitter', 'user_name' => 'test_user'));
 }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:16,代码来源:TestOfExportServiceUserDataController.php

示例10: adminControl

    public function adminControl()
    {
        $this->disableCaching();
        if (!BackupController::checkForZipSupport()) {
            $this->addToView('no_zip_support', true);
        } else {
            $instance_dao = DAOFactory::getDAO('InstanceDAO');
            if (isset($_POST['instance_id'])) {
                $instance = $instance_dao->get($_POST['instance_id']);
                if ($instance != null) {
                    $this->zip_file_short_name = str_replace(' ', '_', $instance->network_username) . "_" . str_replace(' ', '_', $instance->network) . '_user_data.zip';
                    $this->zip_file_full_name = FileDataManager::getDataPath($this->zip_file_short_name);
                    $this->readme_file = FileDataManager::getBackupPath('README.txt');
                    $this->files_to_zip[] = array('path' => $this->readme_file, 'name' => 'README.txt');
                    self::appendToReadme('THINKUP EXPORTED USER DATA
===========================

This zip archive contains all the data related to a specific service user gathered by ThinkUp. This README file ' . 'describes how to import that data into an existing ThinkUp installation.

');
                    if (!self::exportData($instance->network_username, $instance->network)) {
                        return $this->generateView();
                    }
                    self::generateZipFile();
                } else {
                    $this->addErrorMessage('Invalid service user');
                }
            } else {
                //render dropdown and form to get POST['instance_id']
                $owner_dao = DAOFactory::getDAO('OwnerDAO');
                $owner = $owner_dao->getByEmail($this->getLoggedInUser());
                $this->addToView('instances', $instance_dao->getByOwner($owner));
                $this->addInfoMessage('Choose a user to export.');
            }
        }
        return $this->generateView();
    }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:37,代码来源:class.ExportServiceUserDataController.php

示例11: setLastMail

 /**
  * Return the contents of the last email Mailer "sent" out.
  * For testing purposes only; this will return nothing in production.
  * @return str The contents of the last email sent
  */
 private static function setLastMail($message)
 {
     $test_email = FileDataManager::getDataPath(Mailer::EMAIL);
     $fp = fopen($test_email, 'w');
     fwrite($fp, $message);
     fclose($fp);
 }
开发者ID:jkuehl-carecloud,项目名称:ThinkUp,代码行数:12,代码来源:class.Mailer.php

示例12: testCrawlWithAuthError

    public function testCrawlWithAuthError()
    {
        //build active instance owned by a owner
        $instance_with_autherror = array('id' => 5, 'network_username' => 'Liz Lemon', 'network_user_id' => '123456', 'network_viewer_id' => '123456', 'last_post_id' => '0', 'total_posts_in_system' => '0', 'total_replies_in_system' => '0', 'total_follows_in_system' => '0', 'is_archive_loaded_replies' => '0', 'is_archive_loaded_follows' => '0', 'crawler_last_run' => '', 'earliest_reply_in_system' => '', 'avg_replies_per_day' => '2', 'is_public' => '0', 'is_active' => '1', 'network' => 'facebook', 'last_favorite_id' => '0', 'owner_favs_in_system' => '0', 'total_posts_by_owner' => 0, 'posts_per_day' => 1, 'posts_per_week' => 1, 'percentage_replies' => 50, 'percentage_links' => 50, 'earliest_post_in_system' => '2009-01-01 13:48:05', 'favorites_profile' => '0');
        $instance_builder_1 = FixtureBuilder::build('instances', $instance_with_autherror);
        $builders = array();
        $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => 'me@example.com', 'is_activated' => 1));
        $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 5, 'auth_error' => ''));
        //assert invalid_oauth_email_sent_timestamp option is not set
        $option_dao = DAOFactory::getDAO('OptionDAO');
        $plugin_dao = DAOFactory::getDAO('PluginDAO');
        $plugin_id = $plugin_dao->getPluginId('facebook');
        $last_email_timestamp = $option_dao->getOptionByName(OptionDAO::PLUGIN_OPTIONS . '-' . $plugin_id, 'invalid_oauth_email_sent_timestamp');
        $this->assertNull($last_email_timestamp);
        //log in as that owner
        $this->simulateLogin('me@example.com');
        $_SERVER['HTTP_HOST'] = "mytestthinkup";
        //run the crawl
        $fb_plugin = new FacebookPlugin();
        $fb_plugin->crawl();
        //assert that APIOAuthException was caught and recorded in owner_instances table
        $owner_instance_dao = new OwnerInstanceMySQLDAO();
        $owner_instance = $owner_instance_dao->get(1, 5);
        $this->assertEqual($owner_instance->auth_error, 'Error validating access token: Session has expired at unix ' . 'time SOME_TIME. The current unix time is SOME_TIME.');
        //assert that the email notification was sent to the user
        $expected_reg_email_pattern = '/to: me@example.com
subject: Please re-authorize ThinkUp to access Liz Lemon on Facebook
message: Hi! Your ThinkUp installation is no longer connected to the Liz Lemon Facebook account./';
        $actual_reg_email = Mailer::getLastMail();
        $this->debug($actual_reg_email);
        $this->assertPattern($expected_reg_email_pattern, $actual_reg_email);
        //assert invalid_oauth_email_sent_timestamp option has been set
        $last_email_timestamp = $option_dao->getOptionByName(OptionDAO::PLUGIN_OPTIONS . '-' . $plugin_id, 'invalid_oauth_email_sent_timestamp');
        $this->assertNotNull($last_email_timestamp);
        //Delete last mail file
        $test_email_file = FileDataManager::getDataPath(Mailer::EMAIL);
        unlink($test_email_file);
        $actual_reg_email = Mailer::getLastMail();
        //Assert it's been deleted
        $this->assertEqual($actual_reg_email, '');
        //Crawl again
        $fb_plugin->crawl();
        //Assert email has not been resent
        $actual_reg_email = Mailer::getLastMail();
        $this->debug($actual_reg_email);
        $this->assertEqual($actual_reg_email, '');
    }
开发者ID:nagyistoce,项目名称:ThinkUp,代码行数:47,代码来源:TestOfFacebookPlugin.php

示例13: testFreshInstallStep1AllReqsMet

 public function testFreshInstallStep1AllReqsMet()
 {
     self::time(__METHOD__);
     //get whatever session save path is set to
     $session_save_path = ini_get('session.save_path');
     ini_set('session.save_path', FileDataManager::getDataPath());
     //remove config file
     Config::destroyInstance();
     $this->removeConfigFile();
     //drop DB
     $this->testdb_helper->drop($this->test_database_name);
     $controller = new InstallerController(true);
     $this->assertTrue(isset($controller));
     $result = $controller->go();
     $this->debug($result);
     $this->assertPattern('/Your system has everything it needs to run ThinkUp./', $result);
     //make sure we've auto-progressed to step 2 b/c all requirements have been met
     $this->assertPattern('/Create your ThinkUp/', $result);
     $this->restoreConfigFile();
     //reset back to what it was
     ini_set('session.save_path', $session_save_path);
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:22,代码来源:TestOfInstallerController.php

示例14: export

 public function export($backup_file = null)
 {
     // get table names...
     $q = "show tables";
     $q2 = "show create table ";
     $stmt = $this->execute($q);
     $data = $this->getDataRowsAsArrays($stmt);
     $create_tables = '';
     $zip_file = FileDataManager::getDataPath('.htthinkup_db_backup.zip');
     if ($backup_file) {
         $zip_file = $backup_file;
     }
     $zip = new ZipArchive();
     if (file_exists($zip_file)) {
         unlink($zip_file);
     }
     // make sure w can create this zip file, ZipArchive is a little funky and wont let us know its status
     // until we call close
     $zip_create_status = @touch($zip_file);
     if ($zip_create_status) {
         unlink($zip_file);
     }
     $backup_dir = FileDataManager::getBackupPath();
     if (!$zip_create_status || $zip->open($zip_file, ZIPARCHIVE::CREATE) !== TRUE) {
         throw new Exception("Unable to open backup file for exporting: {$zip_file}");
     }
     // write lock tables...
     $table_locks_list = '';
     foreach ($data as $table) {
         foreach ($table as $key => $value) {
             if ($table_locks_list != '') {
                 $table_locks_list .= ', ';
             }
             $table_locks_list .= $value . ' WRITE';
         }
     }
     try {
         $stmt = $this->execute("LOCK TABLES " . $table_locks_list);
         $tmp_table_files = array();
         foreach ($data as $table) {
             foreach ($table as $key => $value) {
                 if (getenv('BACKUP_VERBOSE') !== false) {
                     print "  Backing up data for table: {$value}\n";
                 }
                 $stmt = $this->execute($q2 . $value);
                 $create_tables .= "-- Create {$value} table statement\n";
                 $create_tables .= "DROP TABLE IF EXISTS {$value};\n";
                 $create_data = $this->getDataRowAsArray($stmt);
                 $create_tables .= $create_data["Create Table"] . ";";
                 $create_tables .= "\n\n";
                 // export table data
                 $table_file = FileDataManager::getBackupPath($value . '.txt');
                 if (file_exists($table_file)) {
                     unlink($table_file);
                 }
                 $q3 = "select * INTO OUTFILE '{$table_file}' from {$value}";
                 $stmt = $this->execute($q3);
                 $zip->addFile($table_file, "/{$value}" . '.txt');
                 array_push($tmp_table_files, $table_file);
             }
         }
     } catch (Exception $e) {
         $err = $e->getMessage();
         if (preg_match("/Can't create\\/write to file/", $err) || preg_match("/Can\\'t get stat of/", $err)) {
             // a file perm issue?
             throw new OpenFileException("It looks like the MySQL user does not have the proper file permissions " . "to back up data");
         } else {
             // assume its a GRANT FILE OR LOCK TABLES issue?
             throw new MySQLGrantException("It looks like the MySQL user does not have the proper grant permissions " . "to back up data");
         }
         error_log("export DB OUTFILE error: " . $e->getMessage());
     }
     // unlock tables...
     $stmt = $this->execute("unlock tables");
     if (getenv('BACKUP_VERBOSE') !== false) {
         print "\n  Backing up create table statments\n";
     }
     $zip->addFromString("create_tables.sql", $create_tables);
     $zip_close_status = $zip->close();
     // clean up tmp table files
     foreach ($tmp_table_files as $tmp_file) {
         unlink($tmp_file);
     }
     if ($zip_close_status == false) {
         throw new Exception("Unable to create backup file for exporting. Bad file path?: {$zip_file}");
     }
     return $zip_file;
 }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:88,代码来源:class.BackupMySQLDAO.php

示例15: testNoTimezoneHandling

 public function testNoTimezoneHandling()
 {
     $tz = date_default_timezone_get();
     unlink(FileDataManager::getDataPath(Mailer::EMAIL));
     $builders = array();
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'is_admin' => 1, 'email' => 'daily@example.com', 'is_activated' => 1, 'email_notification_frequency' => 'daily', 'timezone' => ''));
     $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 5, 'auth_error' => ''));
     $builders[] = FixtureBuilder::build('instances', array('network_username' => 'cdmoyer', 'id' => 5, 'network' => 'twitter', 'is_activated' => 1, 'is_public' => 1));
     $builders[] = FixtureBuilder::build('insights', array('id' => 1, 'instance_id' => 5, 'slug' => 'new_group_memberships', 'prefix' => 'Made the List:', 'text' => 'CDMoyer is on 29 new lists', 'time_generated' => date('Y-m-d 03:00:00')));
     $builders[] = FixtureBuilder::build('insights', array('id' => 2, 'instance_id' => 5, 'slug' => 'new_group_memberships', 'prefix' => 'Made the List:', 'text' => 'CDMoyer is on 99 new lists', 'time_generated' => date('Y-m-d 01:00:00')));
     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
     $options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
     $this->assertEqual(count($options), 0);
     $config = Config::getInstance();
     date_default_timezone_set($config->getValue('timezone'));
     $this->simulateLogin('daily@example.com');
     $plugin = new InsightsGeneratorPlugin();
     $plugin->current_timestamp = strtotime('3am');
     // Should not set yet
     $plugin->crawl();
     $sent = Mailer::getLastMail();
     $this->assertEqual('', $sent);
     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
     $options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
     $this->assertEqual(count($options), 0);
     $plugin->current_timestamp = strtotime('5am');
     // SHould send
     $plugin->crawl();
     $sent = Mailer::getLastMail();
     $this->assertNotEqual('', $sent);
     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
     $options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
     $this->assertTrue(count($options) > 0);
     date_default_timezone_set($tz);
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:35,代码来源:TestOfInsightsGeneratorPlugin.php


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