Store
Community Documentation

v3 Knowledgebase

Distributed File System compatibility

**Note: This tutorial requires you to edit source files which voids support, can make the script unstable, can interfere with upgrades and can interfere with other modules that need the edited files. Plugins are the recommended method to make changes and there are tutorials for creating plugins.

Setup:
1) mounting HDFS to the 'file' folder of PHPfox

2)
CHANGES

file.class.php:

////////////////////
public function writeToCache($sFile, $sData)
{
if (file_exists($sFile)) /////// Without, the new file will trunclated
{
unlink($sFile);
}


if ($hFile = @fopen(PHPFOX_DIR_CACHE . $sFile, 'w+'))
{
fwrite($hFile, $sData);
fclose($hFile);
}

return $this;
}

//////////////////////

public function mkdir($sDir, $bRecurse = false, $mChmod = null)
{
if ($bRecurse === true)
{
$aParts = explode(PHPFOX_DS, trim($sDir, PHPFOX_DS));
$sParentDirectory = (Phpfox::getLib('server')->isWindows() ? '' : PHPFOX_DS);

foreach ($aParts as $sDir)
{
if (!is_dir($sParentDirectory . $sDir))
{
mkdir($sParentDirectory . $sDir);
if ($mChmod !== null)
{
chmod($sParentDirectory . $sDir, 0777);
}
}

$sParentDirectory .= $sDir . PHPFOX_DS;
}
}
else
{
if (!is_dir($sDir)) /// Without, directory structure fragmentation might occur
{
mkdir($sDir);
}

if ($mChmod !== null)
{
chmod($sDir, 0777);
}
}
}
////////////////////////







Example running at http://eop-net.com/PHPFOX-DEMO/
running over 3 Hadoop Dataanode

Later will be available:
change of the content files > into a PHP file, which will work out the files privacy access,
Which, is not available on the PHPfox and the Content Delivery Networks.