#1688: RecursiveDirectoryIterator is OS-Specific - Causes Migrations to be
Performed Out of Order
-----------------------------------+----------------------------------------
Reporter: deefour | Owner: jwage
Type: defect | Status: new
Priority: minor | Milestone:
Component: Migrations | Version: 1.1-DEV
Keywords: | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
-----------------------------------+----------------------------------------
I am working with Doctrine_Migration via Doctrine_Cli, using the
Doctrine_Task_Migrate task.
I am using Doctrine 1.1, PHP 5.2.6, and MySQL 5.0.x
Locally I am running darwin (OS X Leopard).
On my server I am running CentOS 5.
Locally, I can run doctrine's migrate cli task without trouble. Having
initially generated my migration classes from an existing database, I have
32 migration classes currently; The first 31 contain the CREATE TABLE
statements for each table in the database, while the 32nd contains the
adding/dropping of all foreign keys.
On darwin, the RecusiveDirectoryIterator pulls the files from the
migration directory ordered properly, according the the prefixed unique
integer in the class filenames.
http://trac.doctrine-
project.org/browser/branches/1.1/lib/Doctrine/Migration.php#L116
On CentOS, the order which the files are pulled from the migration
directory is very different.
In my example,
Using Darwin, the foreign key class (# 32 when running `ls` in shell) is
properly set as version [b]32[/b] during the migration process.
Using CentOS, the foreign key class (# 32 when running `ls` in shell) is
[b]incorrectly[/b] set as version [b]26[/b] during the migration process.
The order that SPL's RecursiveDirectoryIterator (and I'd assume
DirectoryIterator too) grabs the files from the directory is OS-specific.
In the case of an OS like CentOS, this ordering does not follow the
natural sort order of the migration class filenames integer prefixes. This
causes the migrations to be performed out of order.
--
Ticket URL: <
http://trac.doctrine-project.org/ticket/1688>
Doctrine <
http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper