Page 1 of 1

df_update() and df_get_file_system_version()

PostPosted: Fri Jul 22, 2011 12:10 pm
by ADobkin
I've been noticing for a while that my dataface__version table always had '0' listed for the version. So I decided to figure out why.

The dataface_info.php script worked for me and returned the correct version when accessed from a browser. Likewise, version.txt did exist in the active xataface directory. However, the version field was still set to 0 in the database.

I noticed that df_init, which is called by index.php on each page load, checks to see if the filesystem version matches the database version. If not, it calls the df_update function from dataface_public-api.php. The df_update function then updates the database version. In order to check the filesystem version, it looks for the version.txt file. This works fine when accessing php scripts directly under the xataface directory, but it fails when accessed from any of the database applications, because it is not looking in the correct path. So, it always returns 0 for the filesystem version, which matches what is in the database. It doesn't complain, and it doesn't update the version.

To resolve this problem, I prefixed the 'version.txt' filename with the DATAFACE_PATH constant in the df_get_file_system_version. For the first time ever, I got a message stating "The database has been successfully updated to version 2458", and sure enough the dataface__version table has been updated. Success!

So, is this fix necessary to make the version checking and df_update function work properly, or did I possibly have some other configuration problem on my system causing it to look in the wrong path? If the former, please incorporate the path prefix into future releases.


Re: df_update() and df_get_file_system_version()

PostPosted: Fri Jul 22, 2011 1:57 pm
by shannah
The dataface__version table is intended to track the version of your app - not the version of Xataface.
See this post for details:

Re: df_update() and df_get_file_system_version()

PostPosted: Fri Jul 22, 2011 2:11 pm
by ADobkin
Ah, now that makes more sense. Thanks for clarifying that, and the blog post is very helpful!