public function removeContentFile($file, $contentId) {
    $path = "{$this->path}/content/{$contentId}/{$file}";
    if (file_exists($path)) {
      unlink($path);

      // Clean up any empty parent directories to avoid cluttering the file system
      $parts = explode('/', $path);
      while (array_pop($parts) !== NULL) {
        $dir = implode('/', $parts);
        if (is_dir($dir) && count(scandir($dir)) === 2) { // empty contains '.' and '..'
          rmdir($dir); // Remove empty parent
        }
        else {
          return; // Not empty
        }
      }
    }
  }
public function removeContentFile($file, $contentId) {
    $path = "{$this->path}/content/{$contentId}/{$file}";
    if (file_exists($path)) {
      unlink($path);

      // Clean up any empty parent directories to avoid cluttering the file system
      $parts = explode('/', $path);
      while (array_pop($parts) !== NULL) {
        $dir = implode('/', $parts);
        if (is_dir($dir) && count(scandir($dir)) === 2) { // empty contains '.' and '..'
          rmdir($dir); // Remove empty parent
        }
        else {
          return; // Not empty
        }
      }
    }
  }
public function removeContentFile ( $ file , $ contentId ) { $ path = "{$this->path}/content/{$contentId}/{$file}" ; if ( file_exists ( $ path ) ) { unlink ( $ path ) ; // Clean up any empty parent directories to avoid cluttering the file system $ parts = explode ( '/' , $ path ) ; while ( array_pop ( $ parts ) !== NULL ) { $ dir = implode ( '/' , $ parts ) ; if ( is_dir ( $ dir ) && count ( scandir ( $ dir ) ) === 2 ) { // empty contains '.' and '..' rmdir ( $ dir ) ; // Remove empty parent } else { return ; // Not empty } } } }
Checks to see if content has the given file.
Used when saving content.

@param string $file path + name
@param int $contentid
@return string|int File ID or NULL if not found
Checks to see if content has the given file . Used when saving content .