svn: /web/doc-editor/trunk/php/ RepositoryManager.php
| From: | Yannick Torres | Date: | Thu, 29 Apr 2010 05:42:06 +0000 |
| Subject: | svn: /web/doc-editor/trunk/php/ RepositoryManager.php | ||
| Groups: | php.doc.web | ||
| Request: | Send a blank email to doc-web+get-1836@lists.php.net to get a copy of this message | ||
yannick Thu, 29 Apr 2010 05:42:06 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=298756
Log:
Add new method to add a file into the progressWork table
Changed paths:
U web/doc-editor/trunk/php/RepositoryManager.php
Modified: web/doc-editor/trunk/php/RepositoryManager.php
===================================================================
--- web/doc-editor/trunk/php/RepositoryManager.php 2010-04-29 05:07:16 UTC (rev 298755)
+++ web/doc-editor/trunk/php/RepositoryManager.php 2010-04-29 05:42:06 UTC (rev 298756)
@@ -359,6 +359,93 @@
}
/**
+ * Register a file as a work in progress, into the database.
+ *
+ * @param $file The file object to be added into the database.
+ * @param $revision The revision of this file.
+ * @param $en_revision The EN revision of this file.
+ * @param $reviewed The stats of the reviewed tag.
+ * @param $maintainer The maintainer.
+ * @param $type The type of work. Can be 'new' for new file,
'update' for an uptaded file, 'delete' for a file marked as delete.
+ * @return fileID of the file
+ */
+ public function addProgressWork($file, $revision, $en_revision, $reviewed, $maintainer,
$type='update')
+ {
+ $db = DBConnection::getInstance();
+ $am = AccountManager::getInstance();
+ $vcsLogin = $am->vcsLogin;
+ $project = $am->project;
+
+ $s = sprintf(
+ 'SELECT
+ id
+ FROM
+
progressWork
+ WHERE
+ project="%s" AND
+ lang="%s" AND
+ path="%s" AND
+ name="%s"',
+ $project,
+ $file->lang,
+ $file->path,
+ $file->name
+ );
+ $r = $db->query($s);
+
+ // We insert or update the pendingCommit table
+ if ($r->num_rows == 0) {
+
+ $s = sprintf(
+ 'INSERT into
+ progressWork
+ (project, lang, path, name,
revision, en_revision, reviewed, maintainer,
user, date, type)
+ VALUES
+ ("%s", "%s", "%s", "%s",
"%s", "%s", "%s", "%s", "%s", now(),
"%s")',
+ $project,
+ $file->lang,
+ $file->path,
+ $file->name,
+ $revision,
+ $en_revision,
+ $reviewed,
+ $maintainer,
+ $vcsLogin,
+ $type
+ );
+ $db->query($s);
+ $fileID = $db->insert_id();
+
+ } else {
+
+ $a = $r->fetch_object();
+
+ $s = sprintf(
+ 'UPDATE
+ progressWork
+ SET
+ revision="%s",
+ en_revision="%s",
+ reviewed="%s",
+ maintainer="%s"
+ WHERE
+ id="%s"',
+ $revision,
+ $en_revision,
+ $reviewed,
+ $maintainer,
+ $a->id
+ );
+ $db->query($s);
+ $fileID = $a->id;
+ }
+
+ return $fileID;
+ }
+
+ /**
+ * @TODO : DEPRECATED. Need to be removed.
+ *
* Register a file as need to be commited, into the database.
*
* @param $file The file object to be commited.
@@ -1409,6 +1496,8 @@
&& !preg_match('/\.png$/', $name)
&& !preg_match('/\.gif$/', $name)
&& !preg_match('/\.jpg$/', $name)
+ && !preg_match('/\.new$/', $name)
+ && !preg_match('/\.patch$/', $name)
&& $path != '/functions/'
) {
if (is_dir($file->full_path)) {