cvs: pearweb /include pear-rest.php
| From: | Martin Jansen | Date: | Sun, 24 Jul 2005 17:29:51 +0000 |
| Subject: | cvs: pearweb /include pear-rest.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-33269@lists.php.net to get a copy of this message | ||
mj Sun Jul 24 13:29:51 2005 EDT
Modified files:
/pearweb/include pear-rest.php
Log:
* Using is_dir() instead of file_exists() on directory names is at least
semantically more correct.
http://cvs.php.net/diff.php/pearweb/include/pear-rest.php?r1=1.12&r2=1.13&ty=u
Index: pearweb/include/pear-rest.php
diff -u pearweb/include/pear-rest.php:1.12 pearweb/include/pear-rest.php:1.13
--- pearweb/include/pear-rest.php:1.12 Thu Jul 21 13:04:51 2005
+++ pearweb/include/pear-rest.php Sun Jul 24 13:29:50 2005
@@ -13,14 +13,14 @@
global $dbh;
$extra = '/rest/';
$cdir = $this->_restdir . DIRECTORY_SEPARATOR . 'c';
- if (!file_exists($cdir)) {
+ if (!is_dir($cdir)) {
System::mkdir(array('-p', $cdir));
@chmod($cdir, 0777);
}
$category = $dbh->getAll('SELECT * FROM categories WHERE name = ?',
array($category),
DB_FETCHMODE_ASSOC);
$category = $category[0];
- if (!file_exists($cdir . DIRECTORY_SEPARATOR . urlencode($category['name']))) {
+ if (!is_dir($cdir . DIRECTORY_SEPARATOR . urlencode($category['name']))) {
System::mkdir(array('-p', $cdir . DIRECTORY_SEPARATOR .
urlencode($category['name'])));
@chmod($cdir . DIRECTORY_SEPARATOR . urlencode($category['name']), 0777);
}
@@ -66,7 +66,7 @@
{
require_once 'System.php';
$cdir = $this->_restdir . DIRECTORY_SEPARATOR . 'c';
- if (!file_exists($cdir . DIRECTORY_SEPARATOR . urlencode($category))) {
+ if (!is_dir($cdir . DIRECTORY_SEPARATOR . urlencode($category))) {
return;
}
// remove all category info
@@ -77,7 +77,7 @@
function saveAllPackagesREST()
{
$pdir = $this->_restdir . DIRECTORY_SEPARATOR . 'p';
- if (!file_exists($pdir)) {
+ if (!is_dir($pdir)) {
System::mkdir(array('-p', $pdir));
@chmod($pdir, 0777);
}
@@ -106,11 +106,11 @@
$package = package::info($package);
$pdir = $this->_restdir . DIRECTORY_SEPARATOR . 'p';
- if (!file_exists($pdir)) {
+ if (!is_dir($pdir)) {
System::mkdir(array('-p', $pdir));
@chmod($pdir, 0777);
}
- if (!file_exists($pdir . DIRECTORY_SEPARATOR . strtolower($package['name']))) {
+ if (!is_dir($pdir . DIRECTORY_SEPARATOR . strtolower($package['name']))) {
System::mkdir(array('-p', $pdir . DIRECTORY_SEPARATOR .
strtolower($package['name'])));
@chmod($pdir . DIRECTORY_SEPARATOR . strtolower($package['name']), 0777);
@@ -177,7 +177,7 @@
$releases = $dbh->getAll('SELECT * FROM releases WHERE package = ? ORDER BY
releasedate DESC',
array($pid), DB_FETCHMODE_ASSOC);
$rdir = $this->_restdir . DIRECTORY_SEPARATOR . 'r';
- if (!file_exists($rdir)) {
+ if (!is_dir($rdir)) {
System::mkdir(array('-p', $rdir));
@chmod($rdir, 0777);
}
@@ -210,7 +210,7 @@
';
}
$info .= '</a>';
- if (!file_exists($rdir . DIRECTORY_SEPARATOR . strtolower($package))) {
+ if (!is_dir($rdir . DIRECTORY_SEPARATOR . strtolower($package))) {
System::mkdir(array('-p', $rdir . DIRECTORY_SEPARATOR .
strtolower($package)));
@chmod($rdir . DIRECTORY_SEPARATOR . strtolower($package), 0777);
}
@@ -254,7 +254,7 @@
{
require_once 'System.php';
$rdir = $this->_restdir . DIRECTORY_SEPARATOR . 'r';
- if (@file_exists($rdir . DIRECTORY_SEPARATOR . strtolower($package))) {
+ if (@is_dir($rdir . DIRECTORY_SEPARATOR . strtolower($package))) {
@unlink($rdir . DIRECTORY_SEPARATOR . strtolower($package) .
DIRECTORY_SEPARATOR . $version . '.xml');
@unlink($rdir . DIRECTORY_SEPARATOR . strtolower($package) .
@@ -270,13 +270,13 @@
global $dbh;
$extra = '/rest/';
$rdir = $this->_restdir . DIRECTORY_SEPARATOR . 'r';
- if (!file_exists($rdir)) {
+ if (!is_dir($rdir)) {
System::mkdir(array('-p', $rdir));
@chmod($rdir, 0777);
}
$package = $pkgobj->getPackage();
- if (!file_exists($rdir . DIRECTORY_SEPARATOR . strtolower($package))) {
+ if (!is_dir($rdir . DIRECTORY_SEPARATOR . strtolower($package))) {
System::mkdir(array('-p', $rdir . DIRECTORY_SEPARATOR .
strtolower($package)));
@chmod($rdir . DIRECTORY_SEPARATOR . strtolower($package), 0777);
}
@@ -320,7 +320,7 @@
{
require_once 'System.php';
$mdir = $this->_restdir . DIRECTORY_SEPARATOR . 'm';
- if (file_exists($mdir . DIRECTORY_SEPARATOR . $handle)) {
+ if (is_dir($mdir . DIRECTORY_SEPARATOR . $handle)) {
System::rm(array('-r', $mdir . DIRECTORY_SEPARATOR . $handle));
}
}
@@ -335,11 +335,11 @@
$extra = '/rest/';
if (count($maintainers)) {
$pdir = $this->_restdir . DIRECTORY_SEPARATOR . 'p';
- if (!file_exists($pdir)) {
+ if (!is_dir($pdir)) {
System::mkdir(array('-p', $pdir));
@chmod($pdir, 0777);
}
- if (!file_exists($pdir . DIRECTORY_SEPARATOR . strtolower($package))) {
+ if (!is_dir($pdir . DIRECTORY_SEPARATOR . strtolower($package))) {
System::mkdir(array('-p', $pdir . DIRECTORY_SEPARATOR .
strtolower($package)));
@chmod($pdir . DIRECTORY_SEPARATOR . strtolower($package), 0777);
}
@@ -374,11 +374,11 @@
$maintainer = $maintainer[0];
$extra = '/rest/';
$mdir = $this->_restdir . DIRECTORY_SEPARATOR . 'm';
- if (!file_exists($mdir)) {
+ if (!is_dir($mdir)) {
System::mkdir(array('-p', $mdir));
@chmod($mdir, 0777);
}
- if (!file_exists($mdir . DIRECTORY_SEPARATOR . $maintainer['handle'])) {
+ if (!is_dir($mdir . DIRECTORY_SEPARATOR . $maintainer['handle'])) {
System::mkdir(array('-p', $mdir . DIRECTORY_SEPARATOR .
$maintainer['handle']));
@chmod($mdir . DIRECTORY_SEPARATOR . $maintainer['handle'], 0777);
}