本文整理汇总了PHP中Thin\File::mkdir方法的典型用法代码示例。如果您正苦于以下问题:PHP File::mkdir方法的具体用法?PHP File::mkdir怎么用?PHP File::mkdir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thin\File
的用法示例。
在下文中一共展示了File::mkdir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($db, $table)
{
/* CLI case */
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production');
$this->esEnabled = Config::get('es.enabled', true);
$this->db = $db;
$this->table = $table;
$this->setEnv();
$path = $this->dirStore();
if (!is_dir($path . DS . 'dbjson')) {
umask(00);
File::mkdir($path . DS . 'dbjson', 0777, true);
}
if (!is_dir($path . DS . 'dbjson' . DS . Inflector::lower($this->db . '_' . $this->getEnv()))) {
umask(00);
File::mkdir($path . DS . 'dbjson' . DS . Inflector::lower($this->db . '_' . $this->getEnv()), 0777, true);
}
$this->dir = $path . DS . 'dbjson' . DS . Inflector::lower($this->db . '_' . $this->getEnv()) . DS . Inflector::lower($this->table);
if (!is_dir($this->dir)) {
umask(00);
File::mkdir($this->dir, 0777, true);
}
if (true === $this->cacheEnabled) {
$this->getAge();
}
$this->facade();
if (false === CLI) {
$this->session = Session::instance($this);
}
}
示例2: __construct
public function __construct()
{
$args = func_get_args();
$path = STORAGE_PATH;
// $path = isAke(get_defined_constants(), 'STORAGE_PATH', false);
if (0 == count($args)) {
return;
} elseif (2 == count($args)) {
list($db, $table) = $args;
} elseif (3 == count($args)) {
list($db, $table, $path) = $args;
}
if (false === $path) {
throw new Exception("You must provide a path in third argument of this method.");
}
if (!is_dir($path . DS . 'dbjson')) {
umask(00);
File::mkdir($path . DS . 'dbjson', 0777, true);
}
$this->dir = $path . DS . 'dbjson' . DS . Inflector::lower($db) . DS . Inflector::lower($table);
if (!is_dir($path . DS . 'dbjson' . DS . Inflector::lower($db))) {
umask(00);
File::mkdir($path . DS . 'dbjson' . DS . Inflector::lower($db), 0777, true);
}
if (!is_dir($path . DS . 'dbjson' . DS . Inflector::lower($db) . DS . Inflector::lower($table))) {
umask(00);
File::mkdir($path . DS . 'dbjson' . DS . Inflector::lower($db) . DS . Inflector::lower($table), 0777, true);
}
$changeFile = $this->dir . DS . 'change';
if (!File::exists($changeFile)) {
File::put($changeFile, '');
}
$this->db = $db;
$this->table = $table;
}
示例3: model
public function model($data = [])
{
$view = false;
$db = $this->db;
$table = $this->table;
$modelFile = APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models' . DS . Inflector::lower($db) . DS . ucfirst(Inflector::lower($table)) . '.php';
if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql')) {
File::mkdir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql');
}
if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models')) {
File::mkdir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models');
}
if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models' . DS . Inflector::lower($db))) {
File::mkdir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models' . DS . Inflector::lower($db));
}
if (!File::exists($modelFile)) {
File::put($modelFile, str_replace('##class##', ucfirst(Inflector::lower($db)) . ucfirst(Inflector::lower($table)) . 'SQLModel', File::read(__DIR__ . DS . 'dbModel.tpl')));
}
$class = '\\Thin\\' . ucfirst(Inflector::lower($db)) . ucfirst(Inflector::lower($table)) . 'SQLModel';
if (!class_exists($class)) {
require_once $modelFile;
}
$model = $this;
if (true === $view) {
$model = self::instance($db, $table);
}
return new $class($model, $data);
}
示例4: __construct
public function __construct($db)
{
$this->orm = $db;
$this->db = $db->db();
$this->table = $db->table();
$dir = Config::get('dir.blizz.store', session_save_path());
if (!is_dir($dir)) {
File::mkdir($dir);
}
$dir .= DS . Inflector::urlize(Inflector::uncamelize($this->db));
if (!is_dir($dir)) {
File::mkdir($dir);
}
$this->dir = $dir . DS . Inflector::urlize(Inflector::uncamelize($this->table));
if (!is_dir($this->dir)) {
File::mkdir($this->dir);
}
$file = $this->dir . DS . 'data.db';
$new = false;
if (!is_file($file)) {
File::create($file);
$new = true;
File::put($this->dir . DS . 'age.blizz', '');
}
$link = new SQLite3($file);
Now::set("blizz.link.{$this->db}.{$this->table}", $link);
if ($new) {
$this->init();
}
}
示例5: __construct
public function __construct($ns = 'core.cache')
{
if (!is_dir(STORAGE_PATH . DS . 'kit')) {
File::mkdir(STORAGE_PATH . DS . 'kit');
}
$file = STORAGE_PATH . DS . 'kit' . DS . $ns . '.db';
$this->lite = new SQLite3($file);
$q = "CREATE TABLE IF NOT EXISTS content (k VARCHAR PRIMARY KEY, v, ts);";
$this->raw($q);
}
示例6: __construct
public function __construct($db = null, $table = null)
{
$this->db = is_null($db) ? SITE_NAME : $db;
$this->table = is_null($table) ? 'core' : $table;
$this->store = Config::get('dir.flight.store');
$this->db = Inflector::urlize($this->db, '');
$this->table = Inflector::urlize($this->table, '');
if (!$this->store) {
throw new Exception("You must defined in config a dir store for JDB.");
}
if (!is_dir($this->store)) {
File::mkdir($this->store);
}
$this->dir = $this->store . DS . $this->db;
if (!is_dir($this->dir)) {
File::mkdir($this->dir);
}
$this->ids = $this->dir . DS . 'ids.' . $this->table;
if (!file_exists($this->ids)) {
File::put($this->ids, 1);
}
$this->dir .= DS . $this->table;
if (!is_dir($this->dir)) {
File::mkdir($this->dir);
}
$this->age = filemtime($this->dir);
$this->tuplesDir = $this->dir . DS . 'tuples';
if (!is_dir($this->tuplesDir)) {
File::mkdir($this->tuplesDir);
}
$this->cacheDir = $this->dir . DS . 'cache';
if (!is_dir($this->cacheDir)) {
File::mkdir($this->cacheDir);
}
$this->indicesDir = $this->dir . DS . 'indices';
if (!is_dir($this->indicesDir)) {
File::mkdir($this->indicesDir);
}
$this->relationsDir = $this->dir . DS . 'relations';
if (!is_dir($this->relationsDir)) {
File::mkdir($this->relationsDir);
}
}
示例7: __construct
public function __construct($db = null, $table = null)
{
$this->db = is_null($db) ? SITE_NAME : $db;
$this->table = is_null($table) ? 'core' : $table;
$dir = Config::get('dir.blizz.store', session_save_path());
if (!is_dir($dir)) {
File::mkdir($dir);
}
$dir .= DS . Inflector::urlize(Inflector::uncamelize($this->db));
if (!is_dir($dir)) {
File::mkdir($dir);
}
$this->dir = $dir . DS . Inflector::urlize(Inflector::uncamelize($this->table));
if (!is_dir($this->dir)) {
File::mkdir($this->dir);
}
$store = lib('blizzstore', [$this]);
Now::set("blizz.store.{$this->db}.{$this->table}", $store);
$this->cursor = lib('blizzcursor', [$this]);
}
示例8: __construct
public function __construct($db, $table)
{
$path = STORAGE_PATH;
if (!is_dir($path . DS . 'dbarray')) {
umask(00);
File::mkdir($path . DS . 'dbarray', 0777, true);
}
$this->dir = $path . DS . 'dbarray' . DS . Inflector::lower($db) . DS . Inflector::lower($table);
if (!is_dir($path . DS . 'dbarray' . DS . Inflector::lower($db))) {
umask(00);
File::mkdir($path . DS . 'dbarray' . DS . Inflector::lower($db), 0777, true);
}
if (!is_dir($path . DS . 'dbarray' . DS . Inflector::lower($db) . DS . Inflector::lower($table))) {
umask(00);
File::mkdir($path . DS . 'dbarray' . DS . Inflector::lower($db) . DS . Inflector::lower($table), 0777, true);
}
$age = redis()->get(sha1($this->dir));
if (!strlen($age)) {
redis()->set(sha1($this->dir), time() - 24 * 3600);
}
$this->data();
$this->db = $db;
$this->table = $table;
}
示例9: makeOfferIn
function makeOfferIn($basket, $universe, $peopleId, $companyId, $companyaddress_id, $delivery = [], $geo = [])
{
$collection = $collectionPush = [];
$company = Model::Company()->find($companyId);
$people = Model::People()->find($peopleId);
if ($company && $people) {
$companyStatus = isAke($company->assoc(), 'status_id', getStatus('UNCHECKED'));
$offers = [];
if (!empty($basket)) {
$i = 0;
foreach ($basket as $article) {
$dir = realpath(APPLICATION_PATH . DS . '..' . DS . 'public' . DS . 'files' . DS . $universe . DS . 'users' . DS . $peopleId . DS . 'tmp_basket' . DS . $i);
if ($dir) {
$files = glob($dir . DS . '*');
if (!empty($files)) {
foreach ($files as $file) {
$article['attach'][] = $file;
}
}
}
$market = 0;
$item_id = isake($article, 'item_id', 0);
if (0 >= $item_id) {
$market = isAke($article, 'market', 0);
} else {
$family = repo('segment')->getFamilyfromItem($item_id);
if (!empty($family)) {
$market = current($family);
$market = isAke($market, 'id', 0);
}
}
if (0 < $market) {
unset($article['family']);
$offers[$market][] = $article;
}
$i++;
}
}
if (!empty($offers)) {
foreach ($offers as $idMarket => $articles) {
$statusOffer = $companyStatus == getStatus('UNCHECKED') ? getStatus('WAIT') : getStatus('OK');
$offer = bigDb('offerin')->create(['global' => true, 'companyaddress_id' => $companyaddress_id, 'delivery_date' => isAke($delivery, 'date', null), 'delivery_type' => isAke($delivery, 'type', null), 'delivery_moment' => isAke($delivery, 'moment', null), 'expiration' => strtotime('+1 month'), 'universe' => $universe, 'market' => (int) $idMarket, 'status_id' => (int) $statusOffer, 'date' => time(), 'zip' => $company->zip, 'people_id' => (int) $peopleId, 'company_id' => $companyId])->save();
foreach ($geo as $g) {
bigDb('offeringeo')->create(['offerin_id' => $offer->id, 'type' => isAke($g, 'type'), isAke($g, 'type') . '_id' => isAke($g, 'id'), 'range' => isAke($g, 'range')])->save();
}
foreach ($articles as $art) {
$options_comp_name = isAke($art, 'options_comp_name');
$options_comp_val = isAke($art, 'options_comp_val');
$item_id = isAke($article, 'item_id', 0);
if (0 == $item_id) {
$statusOffer = (int) getStatus('ADV');
$offer = $offer->setStatusId($statusOffer)->save();
}
if (!empty($options_comp_name) && !empty($options_comp_val)) {
/* On cherche les doublons d'option le cas échéant */
list($options_comp_name, $options_comp_val) = cleanOptCompOfferIn($options_comp_name, $options_comp_val);
$art['options_comp_name'] = $options_comp_name;
$art['options_comp_val'] = $options_comp_val;
}
$attach = isAke($art, 'attach', []);
unset($art['attach']);
$art['offerin_id'] = $offer->id;
$a = bigDb('articlein')->create($art)->save();
if (!empty($attach)) {
$dirOffer = APPLICATION_PATH . DS . '..' . DS . 'public' . DS . 'files' . DS . $universe . DS . 'offer_in';
if (!is_dir($dirOffer)) {
File::mkdir($dirOffer);
}
$dirOffer .= DS . $offer->id;
if (!is_dir($dirOffer)) {
File::mkdir($dirOffer);
}
$dirOffer .= DS . $a->id;
if (!is_dir($dirOffer)) {
File::mkdir($dirOffer);
}
foreach ($attach as $f) {
$tab = explode(DS, $f);
$nameAttach = Arrays::last($tab);
$newFile = $dirOffer . DS . $nameAttach;
File::copy($f, $newFile);
File::delete($f);
}
}
}
array_push($collection, $offer->assoc());
if ($statusOffer == getStatus('OK')) {
array_push($collectionPush, $offer->assoc());
}
}
}
}
if (!empty($collectionPush)) {
$resellers = lib('bourse')->getResellersByOffer($collectionPush);
$employees = lib('bourse')->getEmployeesToNotif($resellers, $collectionPush);
lib('bourse')->push($employees);
}
return $collection;
}
示例10: generate
public static function generate($model, $overwrite = false)
{
if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'CrudArray')) {
File::mkdir(APPLICATION_PATH . DS . 'models' . DS . 'CrudArray', 0777);
}
$file = APPLICATION_PATH . DS . 'models' . DS . 'CrudArray' . DS . ucfirst(Inflector::camelize($model)) . '.php';
if (!File::exists($file) || $overwrite) {
$db = amodel($model);
$crud = new Crud($db);
File::delete($file);
$tplModel = fgc(__DIR__ . DS . 'Model.tpl');
$tplField = fgc(__DIR__ . DS . 'Field.tpl');
$fields = $crud->fields();
$singular = ucfirst($model);
$plural = $singular . 's';
$default_order = $crud->pk();
$tplModel = str_replace(array('##singular##', '##plural##', '##default_order##'), array($singular, $plural, $default_order), $tplModel);
$fieldsSection = '';
foreach ($fields as $field) {
if ($field != $crud->pk()) {
$label = substr($field, -3) == '_id' ? ucfirst(str_replace('_id', '', $field)) : ucfirst(Inflector::camelize($field));
$fieldsSection .= str_replace(array('##field##', '##label##'), array($field, $label), $tplField);
}
}
$tplModel = str_replace('##fields##', $fieldsSection, $tplModel);
File::put($file, $tplModel);
}
}
示例11: getHashFile
public function getHashFile($hash, $file)
{
if (!is_dir($this->dir . DS . $hash)) {
File::mkdir($this->dir . DS . $hash);
}
return $this->dir . DS . $hash . DS . $file . '.raw';
}
示例12: prepare
private function prepare()
{
$results = $collection = [];
$hash = $this->db->getHash();
$this->cursor = $this->db->motor()->getPath() . DS . 'cursors' . DS . $hash;
if (is_dir($this->cursor)) {
$ageCursor = filemtime($this->cursor . DS . '.');
$ageDb = $this->db->getAge();
if ($ageDb < $ageCursor) {
$this->count = count(glob($this->cursor . DS . '*.php', GLOB_NOSORT));
return;
} else {
File::rmdir($this->cursor);
}
}
File::mkdir($this->db->motor()->getPath() . DS . 'cursors');
File::mkdir($this->db->motor()->getPath() . DS . 'cursors' . DS . $hash);
if (empty($this->db->wheres)) {
$ids = $this->db->motor()->ids('datas');
foreach ($ids as $id) {
$results[$id] = [];
}
unset($ids);
} else {
$results = $this->db->results;
}
$this->count = count($results);
if (empty($results)) {
File::rmdir($this->cursor);
return true;
} else {
$index = 0;
foreach ($results as $id => $row) {
if (false !== $id) {
$file = $this->cursor . DS . $index . '.php';
$data = $this->db->motor()->read('datas.' . $id);
File::put($file, "<?php\nreturn " . var_export($data, 1) . ';');
$index++;
}
}
}
}
示例13: getHashFile
public function getHashFile($hash, $file)
{
$hash = 'hash.' . $hash;
if (!is_dir($this->dir . DS . $hash)) {
File::mkdir($this->dir . DS . $hash);
}
return $this->dir . DS . $hash . DS . $file . '.store';
}
示例14: getFile
private function getFile($name)
{
$path = $this->path;
$tab = $tmp = explode('.', $name);
$fileName = end($tmp) . '.php';
array_pop($tab);
foreach ($tab as $subPath) {
$path .= DS . $subPath;
if (!is_dir($path)) {
File::mkdir($path);
}
}
return $path . DS . $fileName;
}
示例15: checkDir
public static function checkDir($type)
{
$settings = Arrays::exists($type, static::$_settings) ? static::$_settings[$type] : static::defaultConfig($type);
$hook = Arrays::exists('checkDir', $settings) ? $settings['checkDir'] : null;
static::_hook($hook, func_get_args(), 'before');
$dirName = Inflector::lower($type . 's');
$dir = STORAGE_PATH . DS . 'data' . DS . $dirName;
$writeDir = STORAGE_PATH . DS . 'data' . DS . $dirName . DS . 'write';
$readDir = STORAGE_PATH . DS . 'data' . DS . $dirName . DS . 'read';
$versDir = STORAGE_PATH . DS . 'data' . DS . $dirName . DS . 'versions';
$indexDir = STORAGE_PATH . DS . 'data' . DS . $dirName . DS . 'indexes';
File::mkdir($dir, 0777);
File::mkdir($writeDir, 0777);
File::mkdir($readDir, 0777);
File::mkdir($versDir, 0777);
File::mkdir($indexDir, 0777);
static::_hook($hook, func_get_args(), 'after');
return $dirName;
}