~ubuntu-branches/ubuntu/quantal/gallery2/quantal

« back to all changes in this revision

Viewing changes to modules/core/test/phpunit/FileSystemTest.class

  • Committer: Bazaar Package Importer
  • Author(s): Michael C. Schultheiss
  • Date: 2007-09-10 20:22:19 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070910202219-0jsuntvqge4ade6b
Tags: 2.2.3-2
Add Slovak translation of Debconf templates.  (Thanks to 
Ivan Masá.  Closes: #441671)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/*
3
 
 * Gallery - a web based photo album viewer and editor
4
 
 * Copyright (C) 2000-2007 Bharat Mediratta
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation; either version 2 of the License, or (at
9
 
 * your option) any later version.
10
 
 *
11
 
 * This program is distributed in the hope that it will be useful, but
12
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
 * General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
19
 
 */
20
 
 
21
 
/**
22
 
 * Test FileSystem functionality
23
 
 * @package GalleryCore
24
 
 * @subpackage PHPUnit
25
 
 * @author Bharat Mediratta <bharat@menalto.com>
26
 
 * @version $Revision: 15513 $
27
 
 */
28
 
class FileSystemTest extends GalleryTestCase {
29
 
 
30
 
    function FileSystemTest($methodName) {
31
 
        $this->GalleryTestCase($methodName);
32
 
    }
33
 
 
34
 
    function setUp() {
35
 
        global $gallery;
36
 
 
37
 
        parent::setUp();
38
 
 
39
 
        $iterations = 3;
40
 
        $parentId = $this->_getRootId();
41
 
        for ($i = 0; $i < $iterations; $i++) {
42
 
            $gallery->guaranteeTimeLimit(5);
43
 
 
44
 
            list ($ret, $this->_albums[$i]) = $this->_createRandomAlbum($parentId);
45
 
            if ($ret) {
46
 
                print $ret->getAsHtml();
47
 
                return $this->failWithStatus($ret);
48
 
            }
49
 
 
50
 
            $parentId = $this->_albums[$i]->getId();
51
 
        }
52
 
 
53
 
        /* delete the top album */
54
 
        $this->_markForCleanup($this->_albums[0]);
55
 
    }
56
 
 
57
 
    function testFetchItemIdByPath() {
58
 
        $path = '/';
59
 
        for ($i = 0; $i < sizeof($this->_albums); $i++) {
60
 
            $path .= $this->_albums[$i]->getPathComponent() . '/';
61
 
        }
62
 
        list ($ret, $id) = GalleryCoreApi::fetchItemIdByPath($path);
63
 
        if ($ret) {
64
 
            return $this->failWithStatus($ret);
65
 
        }
66
 
 
67
 
        $this->assertEquals($this->_albums[2]->getId(), $id);
68
 
    }
69
 
 
70
 
    function testFetchLogicalPath() {
71
 
        list ($ret, $root) = GalleryCoreApi::loadEntitiesById($this->_getRootId());
72
 
        if ($ret) {
73
 
            return $this->failWithStatus($ret);
74
 
        }
75
 
 
76
 
        list ($ret, $logicalPath) = $root->fetchLogicalPath();
77
 
        if ($ret) {
78
 
            return $this->failWithStatus($ret);
79
 
        }
80
 
 
81
 
        $this->assertEquals('/', $logicalPath);
82
 
 
83
 
        list ($ret, $logicalPath) = $this->_albums[1]->fetchLogicalPath();
84
 
        if ($ret) {
85
 
            return $this->failWithStatus($ret);
86
 
        }
87
 
 
88
 
        $this->assertEquals(sprintf('/%s/%s/',
89
 
                                    $this->_albums[0]->getPathComponent(),
90
 
                                    $this->_albums[1]->getPathComponent()),
91
 
                            $logicalPath);
92
 
 
93
 
        list ($ret, $item) = $this->_createRandomDataItem($this->_albums[1]->getId());
94
 
        if ($ret) {
95
 
            return $this->failWithStatus($ret);
96
 
        }
97
 
 
98
 
        list ($ret, $logicalPath) = $item->fetchLogicalPath();
99
 
        if ($ret) {
100
 
            return $this->failWithStatus($ret);
101
 
        }
102
 
 
103
 
        $this->assertEquals(sprintf('/%s/%s/%s',
104
 
                                    $this->_albums[0]->getPathComponent(),
105
 
                                    $this->_albums[1]->getPathComponent(),
106
 
                                    $item->getPathComponent()),
107
 
                            $logicalPath);
108
 
    }
109
 
 
110
 
    function testFetchPath() {
111
 
        global $gallery;
112
 
        $originalPlatform =& $gallery->getPlatform();
113
 
        $gallery->setPlatform(new FileSystemTestPlatform('/'));
114
 
        $originalAlbumsDir = $gallery->getConfig('data.gallery.albums');
115
 
        $gallery->setConfig('data.gallery.albums', '');
116
 
 
117
 
        list ($ret, $path) = $this->_albums[1]->fetchPath();
118
 
        if ($ret) {
119
 
            return $this->failWithStatus($ret);
120
 
        }
121
 
 
122
 
        $this->assertEquals(sprintf('%s/%s/',
123
 
                                    $this->_albums[0]->getPathComponent(),
124
 
                                    $this->_albums[1]->getPathComponent()),
125
 
                            $path);
126
 
 
127
 
        $gallery->setPlatform(new FileSystemTestPlatform('\\'));
128
 
 
129
 
        list ($ret, $path) = $this->_albums[1]->fetchPath();
130
 
        if ($ret) {
131
 
            return $this->failWithStatus($ret);
132
 
        }
133
 
 
134
 
        $this->assertEquals(sprintf('%s\\%s\\',
135
 
                                    $this->_albums[0]->getPathComponent(),
136
 
                                    $this->_albums[1]->getPathComponent()),
137
 
                            $path);
138
 
 
139
 
        $gallery->setPlatform($originalPlatform);
140
 
        $gallery->setConfig('data.gallery.albums', $originalAlbumsDir);
141
 
    }
142
 
 
143
 
    function testFetchChildIdByPathComponent() {
144
 
        list ($ret, $id) = GalleryCoreApi::fetchChildIdByPathComponent(
145
 
            $this->_albums[1]->getId(), $this->_albums[2]->getPathComponent());
146
 
 
147
 
        $this->assertEquals($this->_albums[2]->getId(), $id);
148
 
    }
149
 
 
150
 
    /**
151
 
     * Verify that creating a second filesystem entity with the same path as
152
 
     * an existing one throws a collision error.
153
 
     */
154
 
    function testCreateCollision() {
155
 
        global $gallery;
156
 
 
157
 
        list ($ret, $lockId) = GalleryCoreApi::acquireWriteLock($this->_albums[0]->getId());
158
 
        if ($ret) {
159
 
            return $this->failWithStatus($ret);
160
 
        }
161
 
 
162
 
        for ($i = 0; $i < 3; $i++) {
163
 
            $entity[$i] = new GalleryFileSystemEntity();
164
 
            $ret = $entity[$i]->create($this->_albums[0]->getId(), 'valid_path.jpg');
165
 
            if ($ret) {
166
 
                return $this->failWithStatus($ret);
167
 
            }
168
 
 
169
 
            $ret = $entity[$i]->save();
170
 
            if ($ret) {
171
 
                return $this->failWithStatus($ret);
172
 
            }
173
 
 
174
 
            if ($i > 0) {
175
 
                $this->assertEquals(sprintf('valid_path_%03d.jpg', $i),
176
 
                                    $entity[$i]->getPathComponent());
177
 
            }
178
 
        }
179
 
 
180
 
        $ret = GalleryCoreApi::releaseLocks($lockId);
181
 
        if ($ret) {
182
 
            return $this->failWithStatus($ret);
183
 
        }
184
 
    }
185
 
 
186
 
    function testMoveCollision() {
187
 
        list ($ret, $lockId) = GalleryCoreApi::acquireWriteLock(array($this->_albums[0]->getId(),
188
 
                                                                      $this->_albums[1]->getId(),
189
 
                                                                      $this->_albums[2]->getId()));
190
 
        if ($ret) {
191
 
            return $this->failWithStatus($ret);
192
 
        }
193
 
 
194
 
        $ret = $this->_albums[1]->rename('foo');
195
 
        if ($ret) {
196
 
            return $this->failWithStatus($ret);
197
 
        }
198
 
        $ret = $this->_albums[1]->save();
199
 
 
200
 
        $ret = $this->_albums[1]->move($this->_albums[0]->getId());
201
 
        if ($ret) {
202
 
            return $this->failWithStatus($ret);
203
 
        }
204
 
 
205
 
        $ret = $this->_albums[2]->rename('foo');
206
 
        if ($ret) {
207
 
            return $this->failWithStatus($ret);
208
 
        }
209
 
        $ret = $this->_albums[2]->move($this->_albums[0]->getId());
210
 
        if ($ret) {
211
 
            return $this->failWithStatus($ret);
212
 
        }
213
 
 
214
 
        $this->assertEquals('foo_001', $this->_albums[2]->getPathComponent());
215
 
 
216
 
        $ret = GalleryCoreApi::releaseLocks($lockId);
217
 
        if ($ret) {
218
 
            return $this->failWithStatus($ret);
219
 
        }
220
 
    }
221
 
 
222
 
    /*
223
 
     * Test the platform->rename($old,$newpath) call of FileSystemEntity::move.
224
 
     * The call should have legal platformspecific slashes.
225
 
     *
226
 
     * It tests not the functionality of FileSystemEntity::move, it only tests if
227
 
     * FileSystemEntity::move uses valid paths (no incorrect slashes) in its call to the platform
228
 
     * specific "rename($oldname, $newname)" function.
229
 
     */
230
 
    function testMoveRenameCall() {
231
 
        global $gallery;
232
 
        /* Use a windows alike mock platfrom */
233
 
        $originalPlatform =& $gallery->getPlatform();
234
 
        /* Acquire the write locks */
235
 
        list ($ret, $lockId) = GalleryCoreApi::acquireWriteLock(array($this->_albums[0]->getId(),
236
 
                                                                      $this->_albums[1]->getId(),
237
 
                                                                      $this->_albums[2]->getId()));
238
 
        if ($ret) {
239
 
            return $this->failWithStatus($ret);
240
 
        }
241
 
        $gallery->setPlatform(new FileSystemTestPlatformForRename('\\'));
242
 
 
243
 
        /* Execute the move command, success expected */
244
 
        $ret = $this->_albums[2]->move($this->_albums[0]->getId());
245
 
        if ($ret) {
246
 
            $gallery->setPlatform($originalPlatform);
247
 
            return $this->failWithStatus($ret);
248
 
        }
249
 
 
250
 
        /* Now change the mock platform to a unix like system */
251
 
        $gallery->setPlatform(new FileSystemTestPlatformForRename('/'));
252
 
        /* And move again album 1 (back, but all virtual move command), success expected */
253
 
        $ret = $this->_albums[2]->move($this->_albums[1]->getId());
254
 
        if ($ret) {
255
 
            $gallery->setPlatform($originalPlatform);
256
 
            return $this->failWithStatus($ret);
257
 
        }
258
 
 
259
 
        $gallery->setPlatform($originalPlatform);
260
 
        $ret = GalleryCoreApi::releaseLocks($lockId);
261
 
        if ($ret) {
262
 
            return $this->failWithStatus($ret);
263
 
        }
264
 
    }
265
 
 
266
 
    function testGetLegalPathComponent() {
267
 
        /* Simple case, no collision */
268
 
        list ($ret, $path) =
269
 
            GalleryCoreApi::getLegalPathComponent('testpath', $this->_albums[2]->getId());
270
 
        if ($ret) {
271
 
            return $this->failWithStatus($ret);
272
 
        }
273
 
        $this->assertEquals('testpath', $path, 'no collision');
274
 
 
275
 
        /* Collision with existing album: _001 gets added */
276
 
        list ($ret, $path) = GalleryCoreApi::getLegalPathComponent(
277
 
                             $this->_albums[1]->getPathComponent(), $this->_albums[0]->getId());
278
 
        if ($ret) {
279
 
            return $this->failWithStatus($ret);
280
 
        }
281
 
        $this->assertEquals($this->_albums[1]->getPathComponent() . '_001', $path,
282
 
                            'avoid collision');
283
 
 
284
 
        /* Ignore self-collision */
285
 
        list ($ret, $path) = GalleryCoreApi::getLegalPathComponent(
286
 
                             $this->_albums[1]->getPathComponent(), $this->_albums[0]->getId(),
287
 
                             $this->_albums[1]->getId());
288
 
        if ($ret) {
289
 
            return $this->failWithStatus($ret);
290
 
        }
291
 
        $this->assertEquals($this->_albums[1]->getPathComponent(), $path, 'ignore self-collision');
292
 
 
293
 
        /* Filename with some invalid path characters and .php extension */
294
 
        list ($ret, $path) = GalleryCoreApi::getLegalPathComponent(
295
 
                             'my/test&file!.php', $this->_albums[1]->getId());
296
 
        if ($ret) {
297
 
            return $this->failWithStatus($ret);
298
 
        }
299
 
        $this->assertEquals('my_test_file__php', $path, 'a few bad characters');
300
 
 
301
 
        /* Filename of all extended characters, except extension: we rewrite with date-filename */
302
 
        list ($ret, $path) = GalleryCoreApi::getLegalPathComponent(
303
 
                             "\xe6\xaa\x94\xe6\xa1\x88.jpg", $this->_albums[1]->getId());
304
 
        if ($ret) {
305
 
            return $this->failWithStatus($ret);
306
 
        }
307
 
        $this->assertEquals(strftime('%Y%m%d') . '.jpg', $path, 'extended characters');
308
 
    }
309
 
 
310
 
    function testPathComponentLength() {
311
 
        global $gallery;
312
 
        $storage =& $gallery->getStorage();
313
 
 
314
 
        $string = '1234567890123456789012345678901234567890123456789012345678901234567890';
315
 
        $string .= '1234567890123456789012345678901234567890123456789012345678901234567890';
316
 
        $this->assertEquals(140, strlen($string), 'precondition: length of test string');
317
 
        
318
 
        
319
 
        list ($ret, $entityInfo) = GalleryCoreApi::describeEntity('GalleryFileSystemEntity');
320
 
        if ($ret) {
321
 
            return $this->failWithStatus($ret);
322
 
        }
323
 
        $size = $entityInfo['GalleryFileSystemEntity']['members']['pathComponent']['size'];
324
 
        
325
 
        $this->assertEquals(128, strlen($storage->_truncateString($string, $size)),
326
 
                'pathComponent string size changed, change the redundant value in ' .
327
 
                'GalleryFileSystemEntityHelper_medium!');
328
 
    }    
329
 
 
330
 
    /* Verify that too long path components get truncated and that the extension gets preserved. */
331
 
    function testGetLegalPathComponentForTruncatedName() {
332
 
        /* Prepare by setting the name of an existing album to a string with max length. */
333
 
        $component = '1234567890123456789012345678901234567890123456789012345678901234567890' .
334
 
                '1234567890123456789012345678901234567890123456789012345678';
335
 
        list ($ret, $lockId) = GalleryCoreApi::acquireWriteLock($this->_albums[0]->getId());
336
 
        if ($ret) {
337
 
            return $this->failWithStatus($ret);
338
 
        }
339
 
        $this->_albums[0]->setPathComponent($component);
340
 
        $ret = $this->_albums[0]->save();
341
 
        if ($ret) {
342
 
            return $this->failWithStatus($ret);
343
 
        }
344
 
        $ret = GalleryCoreApi::releaseLocks($lockId);
345
 
        if ($ret) {
346
 
            return $this->failWithStatus($ret);
347
 
        }
348
 
 
349
 
        /* Execute the test: Get the legal path component for a too long colliding name. */
350
 
        $newComponent = $component . 'abcdefghi.jpg';
351
 
        list ($ret, $path) = GalleryCoreApi::getLegalPathComponent(
352
 
                             $newComponent, $this->_getRootId());
353
 
        if ($ret) {
354
 
            return $this->failWithStatus($ret);
355
 
        }
356
 
        $expectedPathComponent = substr($component, 0, 124) . '.jpg';
357
 
        $this->assertEquals($expectedPathComponent, $path);
358
 
    }
359
 
 
360
 
    function testGetLegalPathComponentForTruncatedNameWithCollision() {
361
 
        /* Prepare the 2nd case, where we try to fix a collision. */
362
 
        $component = '1234567890123456789012345678901234567890123456789012345678901234567890' .
363
 
                '123456789012345678901234567890123456789012345678901234.jpg';
364
 
        list ($ret, $item) = $this->_createRandomDataItem($this->_albums[0]->getId());
365
 
        if ($ret) {
366
 
            return $this->failWithStatus($ret);
367
 
        }
368
 
        list ($ret, $lockId) = GalleryCoreApi::acquireWriteLock($item->getId());
369
 
        if ($ret) {
370
 
            return $this->failWithStatus($ret);
371
 
        }
372
 
        $ret = $item->rename($component);
373
 
        if ($ret) {
374
 
            return $this->failWithStatus($ret);
375
 
        }
376
 
        $ret = $item->save();
377
 
        if ($ret) {
378
 
            return $this->failWithStatus($ret);
379
 
        }
380
 
        $ret = GalleryCoreApi::releaseLocks($lockId);
381
 
        if ($ret) {
382
 
            return $this->failWithStatus($ret);
383
 
        }
384
 
 
385
 
        $this->assertEquals($component, $item->getPathComponent(), 'precondition');
386
 
 
387
 
        /* Execute the test: path component with truncation and collision. */
388
 
        $newComponent = $component . 'abcdefghi.jpg';
389
 
        list ($ret, $path) = GalleryCoreApi::getLegalPathComponent(
390
 
                             $newComponent, $this->_albums[0]->getId());
391
 
        if ($ret) {
392
 
            return $this->failWithStatus($ret);
393
 
        }
394
 
        $expectedPathComponent = substr($component, 0, 120) . '_001.jpg';
395
 
        $this->assertEquals($expectedPathComponent, $path);
396
 
    }
397
 
 
398
 
    /*
399
 
     * Verify that a path component that would be truncated is detected as one that would
400
 
     * collide with an existing path component of max length.
401
 
     */
402
 
    function testCheckPathCollisionTruncation() {
403
 
        /* Prepare by setting the name of an existing album to a string with max length. */
404
 
        $component = '1234567890123456789012345678901234567890123456789012345678901234567890' .
405
 
                '1234567890123456789012345678901234567890123456789012345678';
406
 
        list ($ret, $lockId) = GalleryCoreApi::acquireWriteLock($this->_albums[0]->getId());
407
 
        if ($ret) {
408
 
            return $this->failWithStatus($ret);
409
 
        }
410
 
        $this->_albums[0]->setPathComponent($component);
411
 
        $ret = $this->_albums[0]->save();
412
 
        if ($ret) {
413
 
            return $this->failWithStatus($ret);
414
 
        }
415
 
        $ret = GalleryCoreApi::releaseLocks($lockId);
416
 
        if ($ret) {
417
 
            return $this->failWithStatus($ret);
418
 
        }
419
 
 
420
 
        /* Execute the test: Try to use a path component that collides once it's truncated. */
421
 
        $newComponent = $component . 'abcdefghi';
422
 
        list ($ret, $isCollision) =
423
 
                GalleryCoreApi::checkPathCollision($newComponent, $this->_getRootId());
424
 
        if ($ret) {
425
 
            return $this->failWithStatus($ret);
426
 
        }
427
 
        $this->assertEquals(true, $isCollision);
428
 
    }
429
 
 
430
 
    function testCheckPathCollisionCaseSensitivity() {
431
 
        $pathComponentA = 'test';
432
 
        $pathComponentB = 'TEST';
433
 
        list ($ret, $item) = $this->_createRandomAlbum($this->_albums[0]->getId());
434
 
        if ($ret) {
435
 
            return $this->failWithStatus($ret);
436
 
        }
437
 
        list ($ret, $lockId) = GalleryCoreApi::acquireWriteLock($item->getId());
438
 
        if ($ret) {
439
 
            return $this->failWithStatus($ret);
440
 
        }
441
 
        $ret = $item->rename($pathComponentA);
442
 
        if ($ret) {
443
 
            return $this->failWithStatus($ret);
444
 
        }
445
 
        $ret = $item->save();
446
 
        if ($ret) {
447
 
            return $this->failWithStatus($ret);
448
 
        }
449
 
        $ret = GalleryCoreApi::releaseLocks($lockId);
450
 
        if ($ret) {
451
 
            return $this->failWithStatus($ret);
452
 
        }
453
 
 
454
 
        /* Execute the test: Try a path that only varies in the letter case. */
455
 
        list ($ret, $isCollision) =
456
 
                GalleryCoreApi::checkPathCollision($pathComponentB, $this->_albums[0]->getId());
457
 
        if ($ret) {
458
 
            return $this->failWithStatus($ret);
459
 
        }
460
 
        $this->assertEquals(true, $isCollision);
461
 
    }
462
 
}
463
 
 
464
 
/**
465
 
 * Mock platform
466
 
 *
467
 
 * @package GalleryCore
468
 
 * @subpackage PHPUnit
469
 
 */
470
 
class FileSystemTestPlatform {
471
 
    function FileSystemTestPlatform($separator) {
472
 
        $this->_separator = $separator;
473
 
    }
474
 
 
475
 
    function getDirectorySeparator() {
476
 
        return $this->_separator;
477
 
    }
478
 
}
479
 
 
480
 
 
481
 
/**
482
 
 * Mock platform for the rename method
483
 
 *
484
 
 * Implements all methods used by FileSystemEntity::move()
485
 
 *
486
 
 * @package GalleryCore
487
 
 * @subpackage PHPUnit
488
 
 */
489
 
class FileSystemTestPlatformForRename extends GalleryPlatform {
490
 
    function FileSystemTestPlatformForRename($separator) {
491
 
        $this->_separator = $separator;
492
 
    }
493
 
 
494
 
    function getDirectorySeparator() {
495
 
        return $this->_separator;
496
 
    }
497
 
 
498
 
    /**
499
 
     * Rename a file/dir
500
 
     *
501
 
     * Override rename method for the testMoveRenamePaths
502
 
     * It won't rename the item actually, just check if the paths contain no invalid slashs
503
 
     */
504
 
    function rename($oldname, $newname) {
505
 
        global $gallery;
506
 
        if ($gallery->getDebug()) {
507
 
            $gallery->debug("rename($oldname, $newname)");
508
 
        }
509
 
        /*
510
 
         * Check if there are some platform specific slash problems in the paths
511
 
         * The platform should be forced to have a '\' separator and thus, no '/'
512
 
         * should be found in the paths.
513
 
         */
514
 
        /*
515
 
         * Strip off the g2data path part of the $oldname and $newname, because they are platform
516
 
         * specific and correct anyway.
517
 
         */
518
 
        $oldname = substr($oldname,
519
 
                          strlen($gallery->getConfig('data.gallery.albums')));
520
 
        $newname = substr($newname,
521
 
                          strlen($gallery->getConfig('data.gallery.albums')));
522
 
        /* We had a case where FileSystemEntity::move produced a rename(a,b) path b, which had a
523
 
         * separator too much and this additional seapartor wasn't even platform specific, but
524
 
         * just '/'. The consequence: ->move() didn't work on windows xp.
525
 
         * What we do here is: Force a windows xp separator '\' and check if no '/' separator is
526
 
         * found in the paths. nested ifs are not necessary, but more readable.
527
 
         * And we don't accept // or \\ in our paths. Most probably this won't be an issue, but
528
 
         * it's good to create exactly the paths that we actually indend to create.
529
 
         */
530
 
        if ($this->_separator == '\\') {
531
 
            if (strrchr($oldname, '/') || strrchr($newname, '/')
532
 
                    || strpos($oldname, '\\\\') || strpos($newname, '\\\\')) {
533
 
                return false;
534
 
            }
535
 
        }  else if ($this->_separator == '/') {
536
 
            if (strrchr($oldname, '\\') || strrchr($newname, '\\')
537
 
                    || strpos($oldname, '//') || strpos($newname, '//')) {
538
 
                return false;
539
 
            }
540
 
        }
541
 
 
542
 
        /* Now pretend the rename command was successful */
543
 
        return true;
544
 
    }
545
 
}
546
 
?>