Update domframework to be gettext package compliant

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1661 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-08-06 13:16:43 +00:00
parent ab7f76d0bb
commit b8a3e1aa23
13 changed files with 223 additions and 111 deletions

View File

@@ -69,25 +69,30 @@ class cachefile
public function cachedir ()
{
if (! isset ($this->directory) || $this->directory === "")
throw new Exception (_("No cache directory defined"), 500);
throw new Exception (dgettext("domframework",
"No cache directory defined"), 500);
if (! file_exists ($this->directory))
{
// Need to create the cache dir
$parent = realpath (dirname ($this->directory));
if (! is_writeable (dirname ($this->directory)))
throw new Exception (sprintf (_(
throw new Exception (sprintf (dgettext("domframework",
"Directory %s is not writable : can not create cache directory"),
$parent), 500);
if (!mkdir ($this->directory))
throw new Exception (sprintf (_("Can not create cache directory %s"),
throw new Exception (sprintf (dgettext("domframework",
"Can not create cache directory %s"),
$this->directory), 500);
chmod ($this->directory, 0777);
}
if (! is_writable ($this->directory))
throw new Exception (sprintf (_("Cache directory %s is not writable"),
throw new Exception (sprintf (dgettext("domframework",
"Cache directory %s is not writable"),
$this->directory), 500);
if (! is_readable ($this->directory))
throw new Exception (sprintf (_("Cache directory %s is not readable"),
throw new Exception (sprintf (dgettext("domframework",
"Cache directory %s is not readable"),
$this->directory), 500);
if (!file_exists ($this->directory."/.htaccess"))
file_put_contents ($this->directory."/.htaccess", "deny from all\n");
@@ -105,7 +110,8 @@ class cachefile
if ($this->nocache !== false)
return false;
if ($data === false)
throw new Exception (_("Can not store FALSE in cache"), 500);
throw new Exception (dgettext("domframework",
"Can not store FALSE in cache"), 500);
try
{
$this->cachedir ();
@@ -148,10 +154,12 @@ class cachefile
if (!file_exists ($fileCache))
return false;
if (!is_readable ($fileCache))
throw new Exception (sprintf (_("File cache %s is not readable"),
throw new Exception (sprintf (dgettext("domframework",
"File cache %s is not readable"),
$fileCache), 500);
if (!is_writable ($fileCache))
throw new Exception (sprintf (_("File cache %s is not writable"),
throw new Exception (sprintf (dgettext("domframework",
"File cache %s is not writable"),
$fileCache), 500);
// Lock : waiting the reconstruction of the cache by another process
// Waiting 10s maximum to re-create the cache file