本文整理汇总了PHP中dir::move方法的典型用法代码示例。如果您正苦于以下问题:PHP dir::move方法的具体用法?PHP dir::move怎么用?PHP dir::move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dir
的用法示例。
在下文中一共展示了dir::move方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changeNum
static function changeNum($uid, $num)
{
$p = self::childByUID($uid);
if (!$p) {
return array('status' => 'error', 'msg' => l::get('pages.errors.notfound'));
}
if ($num == $p->num()) {
return array('status' => 'success', 'msg' => l::get('nochanges'));
}
$dirname = dirname($p->root()) . '/' . $num . '-' . $p->uid();
if (!dir::move($p->root(), $dirname)) {
return array('status' => 'error', 'msg' => l::get('pages.errors.move'));
}
return array('status' => 'success', 'msg' => l::get('pages.moved'));
}
示例2: move
/**
* Moves the directory to a new location
*
* @param string $to
* @return boolean
*/
public function move($to)
{
if (!dir::move($this->root, $to)) {
return false;
} else {
$this->root = true;
return true;
}
}
示例3: hide
/**
* Make the page invisible by removing the prepended number
*/
public function hide()
{
if ($this->isInvisible()) {
return true;
}
$root = dirname($this->root()) . DS . $this->uid();
if (!dir::move($this->root(), $root)) {
throw new Exception('The directory could not be moved');
}
$this->dirname = $this->uid();
$this->num = null;
$this->root = $root;
$this->kirby->cache()->flush();
$this->reset();
return true;
}
示例4: testMove
public function testMove()
{
$this->assertTrue(dir::move($this->tmpDir, $this->movedDir));
}
示例5: relocate
protected function relocate()
{
if ($this->old['created'] == $this->data['created']) {
return;
}
$old = clone $this;
$old->created = $this->old['created'];
if (!$old->exists()) {
return;
}
if (!dir::make($this->root())) {
throw new Exception('The new directory could not be created');
}
if (!dir::move($old->root(), $this->root())) {
throw new Exception('The directory could not be moved');
}
$this->library->clean($old->root('day'));
}
示例6: move
/**
* Move the source to the final destination
*/
protected function move()
{
$exists = $this->pluginExists();
$error = $exists ? 'The plugin could not be updated' : 'The plugin could not be installed';
$success = $exists ? 'The plugin has been updated to version:' : 'The plugin has been installed at version:';
if ($exists) {
$this->output->writeln('<info>Updating plugin...</info>');
} else {
$this->output->writeln('<info>Installing plugin...</info>');
}
$this->output->writeln('<info></info>');
$this->prepare();
$src = $this->source();
$dest = $this->destination();
// overwriting means having to clean the plugin first
if (is_dir($dest)) {
if (!dir::remove($dest)) {
throw new RuntimeException('The old plugin could not be removed before the update');
}
}
if (is_file($src)) {
if (!f::move($src, $dest)) {
throw new RuntimeException($error);
}
} else {
if (is_dir($src)) {
if (!dir::move($src, $dest)) {
throw new RuntimeException($error);
}
} else {
throw new RuntimeException('Invalid source');
}
}
$this->output->writeln('<comment>' . $success . ' "' . $this->version() . '"</comment>');
}