Filesystem::rename PHP Метод

rename() публичный статический Метод

public static rename ( $file, $newName )
    public static function rename($file, $newName)
    {
        $file = self::path($file);
        if (self::exists($file)) {
            return rename($file, dirname($file) . '/' . $newName);
        }
        return false;
    }

Usage Example

 public function setKeys(array $keys, $ttl = null)
 {
     $this->validateKeys(array_keys($keys));
     $this->lockCache(15);
     if ($ttl) {
         $ttl_epoch = time() + $ttl;
     } else {
         $ttl_epoch = null;
     }
     foreach ($keys as $key => $value) {
         $dict = array('value' => $value);
         if ($ttl_epoch) {
             $dict['ttl'] = $ttl_epoch;
         }
         try {
             $key_file = $this->getKeyFile($key);
             $key_dir = dirname($key_file);
             if (!Filesystem::pathExists($key_dir)) {
                 Filesystem::createDirectory($key_dir, $mask = 0755, $recursive = true);
             }
             $new_file = $key_file . '.new';
             Filesystem::writeFile($new_file, serialize($dict));
             Filesystem::rename($new_file, $key_file);
         } catch (FilesystemException $ex) {
             phlog($ex);
         }
     }
     $this->unlockCache();
     return $this;
 }
All Usage Examples Of Filesystem::rename