sparqapi/api/application/helpers/symlinks_helper.php
2020-03-06 18:00:48 +05:30

40 lines
735 B
PHP

<?php
class SYMLINKS
{
public static function createSymLinks($pd_id = null,$output_file2 = null)
{
//echo SELF::checkOS();
//check os
if(SELF::checkOS() === 'LINUX')
{
$symbalic_path = $_SERVER['DOCUMENT_ROOT'].'/ssa_external_data/'.ENVIRONMENT;
$link_to_be_create = '/var/www/html/ssa_external_data/'. ENVIRONMENT.'/pd_reports/'. $pd_id . "/sample.pdf";
EXTERNAL_DIR_CHECK::checkExternalDirectory($pd_id,$symbalic_path);
if(!file_exists($link_to_be_create))
{
symlink($output_file2,$link_to_be_create);
}
}
}
public static function checkOS()
{
if (strtoupper(substr(PHP_OS_FAMILY, 0, 3)) === 'WIN')
{
return 'WIN';
} else {
return 'LINUX';
}
}
}
?>