Beispiel #1
0
 /**
  * Fix connection record(s) after local change to parent folder
  *
  * @param	   string	$service	Service name (google)
  * @param	   integer	$uid		User ID
  * @param	   string	$dir		Directory path
  * @param	   string	$action		Action
  * @param	   string	$newdir		New directory path
  * @param	   string	$parentId	Parent ID
  *
  * @return	   array
  */
 public function fixConvertedItems($service = 'google', $uid = 0, $dir = '', $action = '', $newdir = '', $parentId = '')
 {
     if (!$dir || !$action) {
         return false;
     }
     $objRFile = new \Components\Projects\Tables\RemoteFile($this->_db);
     $converted = $objRFile->getRemoteConnections($this->model->get('id'), $service, $dir, 1);
     if (!empty($converted['paths'])) {
         foreach ($converted['paths'] as $c) {
             // Delete record
             if ($action == 'D') {
                 $objRFile->deleteRecord($this->model->get('id'), $service, $c['remote_id']);
             } elseif ($newdir) {
                 // Update dir path
                 $fpath = $newdir . DS . basename($c['path']);
                 $update = $objRFile->updateRecord($this->model->get('id'), $service, $c['remote_id'], $fpath, $c['type'], $uid, $parentId);
             }
         }
     }
 }