Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

agAPPLICATION_PATH & getcwd()

edited August 2005 in Vanilla 1.0 Help
Hi, The application path on my development server is different from the path on the application server, so I figured to change: define("agAPPLICATION_PATH", "/application/path/different/server/"); into define("agAPPLICATION_PATH", getcwd() ."/"); This worked just fine, browsing and posting on the forum works as it should. But changing settings, making sticky, closing a topic or any of those functions, don't get stored. I wonder why this is and how it could be fixed so that I won't have to change the application path for each server? I can't imagine anyhting that could cause this. Thanks, z

Comments

  • I'm guessing the cwd when the agAPPLICATION_PATH is used in those functions is returning a sub directory, I'd suggest putting in an if block that looks at getcwd and if it contains something unique to the server set it to the server path otherwise set it to the client path. I haven't had enough coffee yet to even write something that simple though!
  • lechlech Chicagoland
    if settings are not getting stored, but the application isn't reporting errors, this could just be a simple slip in permissions on the /appg/settings.php file. perform a chmod 666 on that file along with languages.php and extensions.php and you should be all good.
  • jaseone: Yes, I could write a hack, but I don't want to break the original sources too much, and I think the getcwd() thing should just work. I am wondering why it only works partly. I guess I will look a bit deeper into the code and see what's wrong. lech: It's not a permission problem. Changing the path to getcwd() breaks it, putting in the actual path fixes everything. By the way, it's not just file changes, also database changes that don't work(like sticky or closed on a topic).
  • For example the script that makes a post sticky is /tools/switch.php so I believe getcwd() will return that directory as it is the main script for the request, which is not what the agAPPLICATION_PATH is expecting.
  • jaseone: Thank you, just the example I needed. So this could be fixed by defining getcwd() earlier, when it is still in the root directory(if it ever gets there when going to switch, I guess not). Or by making a function that will always look for the webroot, not the cwd, and then add the directory name of the forum. I'll give it a try, thanks.
  • MarkMark Vanilla Staff
    For the record, the next rev has a custom conf directory where you can store install-specific settings. So, you can just not upload that directory when you are uploading from one server to another, and nothing will break.
This discussion has been closed.