本文整理汇总了PHP中SaeStorage::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeStorage::getList方法的具体用法?PHP SaeStorage::getList怎么用?PHP SaeStorage::getList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeStorage
的用法示例。
在下文中一共展示了SaeStorage::getList方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionImageManager
public function actionImageManager()
{
$path = "data/editor/image/" . Ibos::app()->user->uid;
$action = EnvUtil::getRequest("action");
if ($action == "get") {
if (!defined("SAE_TMP_PATH")) {
$files = $this->getfiles($path);
if (!$files) {
return null;
}
rsort($files, SORT_STRING);
$str = "";
foreach ($files as $file) {
$str .= "../../../../../../" . $file . "ue_separate_ue";
}
echo $str;
} else {
$st = new SaeStorage();
$num = 0;
while ($ret = $st->getList("data", $path, 100, $num)) {
foreach ($ret as $file) {
if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
echo $st->getUrl("data", $file) . "ue_separate_ue";
}
$num++;
}
}
}
}
}
示例2: printTestCases
function printTestCases($pid, $OJ_DATA)
{
if (strstr($OJ_DATA, "saestor:")) {
// echo "<debug>$pid</debug>";
$store = new SaeStorage();
$ret = $store->getList("data", "{$pid}", 100, 0);
foreach ($ret as $file) {
// echo "<debug>$file</debug>";
if (!strstr($file, "sae-dir-tag")) {
$pinfo = pathinfo($file);
if (isset($pinfo['extension']) && $pinfo['extension'] == "in" && $pinfo['basename'] != "sample.in") {
$f = basename($pinfo['basename'], "." . $pinfo['extension']);
$outfile = "{$pid}/" . $f . ".out";
$infile = "{$pid}/" . $f . ".in";
if ($store->fileExists("data", $infile)) {
echo "<test_input><![CDATA[" . $store->read("data", $infile) . "]]></test_input>\n";
}
if ($store->fileExists("data", $outfile)) {
echo "<test_output><![CDATA[" . $store->read("data", $outfile) . "]]></test_output>\n";
}
// break;
}
}
}
} else {
$ret = "";
$pdir = opendir("{$OJ_DATA}/{$pid}/");
while ($file = readdir($pdir)) {
$pinfo = pathinfo($file);
if (isset($pinfo['extension']) && $pinfo['extension'] == "in" && $pinfo['basename'] != "sample.in") {
$ret = basename($pinfo['basename'], "." . $pinfo['extension']);
$outfile = "{$OJ_DATA}/{$pid}/" . $ret . ".out";
$infile = "{$OJ_DATA}/{$pid}/" . $ret . ".in";
if (file_exists($infile)) {
echo "<test_input><![CDATA[" . file_get_contents($infile) . "]]></test_input>\n";
}
if (file_exists($outfile)) {
echo "<test_output><![CDATA[" . file_get_contents($outfile) . "]]></test_output>\n";
}
// break;
}
}
closedir($pdir);
return $ret;
}
}
示例3: imageManager
/**
* @function imageManager
*/
public function imageManager()
{
header("Content-Type: text/html; charset=utf-8");
//需要遍历的目录列表,最好使用缩略图地址,否则当网速慢时可能会造成严重的延时
$paths = array(Upload_PATH, 'upload1/');
// $action = htmlspecialchars($_POST["action"]);
$action = htmlspecialchars($_REQUEST["action"]);
if ($action == "get") {
if (!defined('SAE_TMP_PATH')) {
$files = array();
foreach ($paths as $path) {
//$dir = new Dir();
//$tmp = $dir->getfiles($path);
$tmp = File::getFiles($path);
if ($tmp) {
$files = array_merge($files, $tmp);
}
}
if (!count($files)) {
return;
}
rsort($files, SORT_STRING);
$str = "";
foreach ($files as $file) {
$str .= __ROOT__ . '/' . $file . "ue_separate_ue";
}
echo $str;
} else {
// SAE环境下
$st = new \SaeStorage();
// 实例化
/*
* getList:获取指定domain下的文件名列表
* return: 执行成功时返回文件列表数组,否则返回false
* 参数:存储域,路径前缀,返回条数,起始条数
*/
$num = 0;
while ($ret = $st->getList(get_opinion('SaeStorage'), null, 100, $num)) {
foreach ($ret as $file) {
if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
echo $st->getUrl('upload', $file) . "ue_separate_ue";
}
$num++;
}
}
}
}
}
示例4: count
$sql = "UPDATE `problem` SET `accepted`=(SELECT count(1) FROM `solution` WHERE `problem_id`={$pid} AND `result`=4) WHERE `problem_id`={$pid}";
//echo $sql;
mysqli_query($mysqli, $sql);
$sql = "UPDATE `problem` SET `submit`=(SELECT count(1) FROM `solution` WHERE `problem_id`={$pid}) WHERE `problem_id`={$pid}";
//echo $sql;
mysqli_query($mysqli, $sql);
} else {
if (isset($_POST['checklogin'])) {
echo "1";
} else {
if (isset($_POST['gettestdatalist'])) {
$pid = intval($_POST['pid']);
if ($OJ_SAE) {
//echo $OJ_DATA."$pid";
$store = new SaeStorage();
$ret = $store->getList("data", "{$pid}", 100, 0);
foreach ($ret as $file) {
if (!strstr($file, "sae-dir-tag")) {
$file = pathinfo($file);
$file = $file['basename'];
echo $file . "\n";
}
}
} else {
$dir = opendir($OJ_DATA . "/{$pid}");
while (($file = readdir($dir)) != "") {
if (!is_dir($file)) {
$file = pathinfo($file);
$file = $file['basename'];
echo "{$file}\n";
}
示例5: SaeStorage
<?php
header("Content-Type:text/html;charset='utf-8'");
$storage = new SaeStorage();
$glInfo = array('domain' => 'test', 'prefix' => '', 'limit' => '100', 'offset' => 0);
$ret = $storage->getList($glInfo['domain'], $glInfo['prefix'], $glInfo['limit'], $glInfo['offset']);
$allow_ext = array('image' => array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'psd'), 'flash' => array('swf', 'flv'), 'media' => array('mp3', 'wav', 'wma', 'wmv', 'mid', 'avi', 'mpg', 'asf', 'rm', 'rmvb'), 'file' => array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'htm', 'html', 'txt', 'zip', 'rar', 'gz', 'bz2'));
//容许的文件扩展名
$fileInfo = null;
for ($i = 0; $i < count($ret); $i++) {
if (substr($ret[$i], "-" . strlen('/.placeholder')) != '/.placeholder') {
$file_ext = strtolower(trim(array_pop(explode(".", $ret[$i]))));
if (in_array($file_ext, $allow_ext['image']) === true) {
$format = 'image';
} else {
if (in_array($file_ext, $allow_ext['flash']) === true) {
$format = 'flash';
} else {
if (in_array($file_ext, $allow_ext['media']) === true) {
$format = 'media';
} else {
if (in_array($file_ext, $allow_ext['file']) === true) {
$format = 'file';
} else {
$format = 'unknown';
}
}
}
}
$baseInfo = $storage->getAttr($glInfo['domain'], $ret[$i]);
$fileInfo[$i]['file_ext'] = $file_ext;
示例6: SaeStorage
<?php
include_once 'saestorage.class.php';
$stor = new SaeStorage();
$file_url = $stor->getUrl("darkblue", "100.jpg");
echo $file_url;
//http://darkblueacgstandby-darkblue.stor.sinaapp.com/images/loli/100.jpg
$pic_url = "http://darkblueacgstandby-darkblue.stor.sinaapp.com/images/loli/" . $random_id . ".jpg";
$domain = "darkblue";
$path = "darkblue/images/loli";
$pic_num = getFilesNum($domain, $path);
echo $pic_num;
// 列出 Domain 下所有路径以photo开头的文件
$stor = new SaeStorage();
$num = 0;
//string $domain, [string $prefix = NULL], [int $limit = 10], [int $offset = 0]
while ($ret = $stor->getList("darkblue", NULL, 100, $num)) {
foreach ($ret as $file) {
// echo "{$file}\n";
$num++;
}
}
// echo "\nTOTAL: {$num} files\n";
示例7: ue_mgimg
public function ue_mgimg()
{
$setting = C('EDITOR_UPLOAD');
$files = array();
if (!defined('SAE_TMP_PATH')) {
$imgRootPath = $setting['rootPath'];
$paths = array('');
$files = $this->getfiles($imgRootPath);
} else {
// SAE环境下
$st = new \SaeStorage();
// 实例化
$driverConf = C("UPLOAD_SAE_CONFIG");
/*
* getList:获取指定domain下的文件名列表
* return: 执行成功时返回文件列表数组,否则返回false
* 参数:存储域,路径前缀,返回条数,起始条数
*/
$num = 0;
while ($ret = $st->getList($driverConf['domain'], NULL, 100, $num)) {
foreach ($ret as $file) {
if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
$files[$num] = $st->getUrl($driverConf['domain'], $file);
}
$num++;
}
}
}
if (!count($files)) {
return;
}
rsort($files, SORT_STRING);
$str = implode('|', $files);
echo $str;
}
示例8: SaeStorage
<?php
require_once 'saestorage.class.php';
#your app accesskey
$accesskey = 'enter_your_app_accesskey';
#your app secretkey
$secretkey = 'enter_your_app_secretkey';
#your doamin name
$domain = 'enter_your_doamin_name';
$storage = new SaeStorage($accesskey, $secretkey);
$filesNum = $storage->getFilesNum($domain);
$fileList = $storage->getList($domain);
//print_r($fileList);
foreach ($fileList as $oneFile) {
$fileName = $oneFile['fileName'];
//var_dump($fileName);
echo $fileName;
$fileNameNoDir = explode("/", $fileName)[1];
if (!file_exists($fileNameNoDir)) {
$fileUrl = $storage->getUrl($domain, $fileName);
$cmd = 'wget ' . $fileUrl;
shell_exec($cmd);
}
}
示例9: SaeStorage
<?php
//遍历Domain下所有文件
$stor = new SaeStorage();
$num = 0;
while ($ret = $stor->getList("box", "*", 100, $num)) {
foreach ($ret as $file) {
echo "{$file}\n";
$num++;
}
}
echo "\nTOTAL: {$num} files\n";
?>
<?php
$domain = "box";
$filename = "SAE_SDK_Windows_1.0.5.Build1105301821.zip";
$url = $stor->getUrl($domain, $filename);
echo $url;
示例10: getfiles
if ($action == "get") {
if (!defined('SAE_TMP_PATH')) {
$files = getfiles($path);
if (!$files) {
return;
}
rsort($files, SORT_STRING);
$str = "";
foreach ($files as $file) {
$str .= $file . "ue_separate_ue";
}
echo $str;
} else {
$st = new SaeStorage();
$num = 0;
while ($ret = $st->getList("upload", NULL, 100, $num)) {
foreach ($ret as $file) {
if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
echo $st->getUrl('upload', $file) . "ue_separate_ue";
}
$num++;
}
}
}
}
/**
* 遍历获取目录下的指定类型的文件
* @param $path
* @param array $files
* @return array
*/
示例11: SaeStorageList
function SaeStorageList($Prefix)
{
$storage = new SaeStorage();
$domain = Sae_Storage_Domain_Name;
$result = array();
//默认空数组
$limit = 100;
//列表数量
$offset = 0;
//偏移量
while ($temp = $storage->getList($domain, $Prefix, $limit, $offset)) {
foreach ($temp as $file) {
$result[] = $file;
$num++;
}
}
return $result;
//注意:最大只能列出10000条数据。
}
示例12: count
$sql = "UPDATE `problem` SET `accepted`=(SELECT count(1) FROM `solution` WHERE `problem_id`={$pid} AND `result`=4) WHERE `problem_id`={$pid}";
//echo $sql;
mysql_query($sql);
$sql = "UPDATE `problem` SET `submit`=(SELECT count(1) FROM `solution` WHERE `problem_id`={$pid}) WHERE `problem_id`={$pid}";
//echo $sql;
mysql_query($sql);
} else {
if (isset($_POST['checklogin'])) {
echo "1";
} else {
if (isset($_POST['gettestdatalist'])) {
$pid = intval($_POST['pid']);
if ($OJ_SAE) {
//echo $OJ_DATA."$pid";
$store = new SaeStorage();
$ret = $store->getList("data", "{$pid}");
foreach ($ret as $file) {
if (!strstr($file, "sae-dir-tag")) {
$file = pathinfo($file);
$file = $file['basename'];
echo $file . "\n";
}
}
} else {
$dir = opendir($OJ_DATA . "/{$pid}");
while (($file = readdir($dir)) != "") {
if (!is_dir($file)) {
$file = pathinfo($file);
$file = $file['basename'];
echo "{$file}\n";
}
示例13: SaeStorage
/**
* Delete all existing cache files
*
* @access public
* @return bool
*/
function delete_all()
{
//---change---//
//delete_files($this->db->cachedir, TRUE);
if ($this->db->cache_method == "storage") {
$storage = new SaeStorage();
$file_list = $storage->getList($this->db->cachedir);
for ($i = 0; $i < count($file_list); $i++) {
$storage->delete($this->db->cachedir, $file_list[$i]);
}
if (count($file_list) == 100) {
delete_all();
}
} else {
$mmc = memcache_init();
if ($mmc) {
$catalog_data = memcache_get($mmc, $this->db->cachedir);
$catalog;
if ($catalog_data == false) {
return false;
} else {
$catalog = unserialize($catalog_data);
}
foreach ($catalog as $key => $value) {
memcache_delete($mmc, $key);
}
$catalog = array();
memcache_set($mmc, $this->db->cachedir, serialize($catalog));
}
}
}