Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
Report any technical problems you discover and discuss solutions.

TOPIC:

import/ needs to be writeable 10 years 7 months ago #1393

  • cgoacher
  • cgoacher's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 26
  • Thank you received: 0
Hi, I've recently had to take over our the responsibility of managing our Xerte installation and we've found an issue when trying to import templates (Previously exported from another installation as .zips) where we receive the message "import/ needs to be writeable" when clicking the 'Upload' button.

Our system runs on a Windows 2008 R2 machine with PHP 5.2.14 and IIS 7.

Looking in Windows, the import folder seems to have write and modify permissions for the Application Pool used by the website in IIS so I'm really not sure why it doesn't think it's writeable.

I was wondering if anybody had any ideas on this?

Thanks

Craig

Please Connexion or Create an account to join the conversation.

import/ needs to be writeable 10 years 7 months ago #1394

  • tom
  • tom's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 1275
  • Thank you received: 320
What version of XOT are you using?

I've fixed an issue with PHP on Windows 6 months ago.

Please Connexion or Create an account to join the conversation.

import/ needs to be writeable 10 years 7 months ago #1395

  • cgoacher
  • cgoacher's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 26
  • Thank you received: 0
Hi Tom,

Sorry it would probably help if I'd have included that information too!

It's version 2.0 (svn r895) according to what's on the server.

Thanks

Craig

Please Connexion or Create an account to join the conversation.

import/ needs to be writeable 10 years 7 months ago #1396

  • tom
  • tom's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 1275
  • Thank you received: 320
I don't know how knowledgeable you are, but the fact that you are checking the Application Pool suggest that you probably are... :-)

The PHP function is_writable is broken on Windows. I replaced it with a different function, that I can send you. But , you might consider commenting a few lines out in website_code/php/imposrt/import.php near line 736:
    if(!is_writeable($xerte_toolkits_site->import_path)) { 
        _debug("{$xerte_toolkits_site->import_path} needs to be writeable. Cannot perform import");
        die("{$xerte_toolkits_site->import_path} needs to be writeable");
    }

Please Connexion or Create an account to join the conversation.

import/ needs to be writeable 10 years 7 months ago #1411

  • cgoacher
  • cgoacher's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 26
  • Thank you received: 0
Thanks Tom,

Yeah I'd managed to track the issue down to that part of the code and Google had suggested that certain versions of PHP in the past had issues with that function on Windows but I wasn't sure if this may have been resolved since but I guess not.

If you do have an alternative function that we could replace this with then that would be excellent and I would be very grateful and interested to take a look.

Thanks again

Craig

Please Connexion or Create an account to join the conversation.

import/ needs to be writeable 10 years 7 months ago #1412

  • tom
  • tom's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 1275
  • Thank you received: 320
This is what we use (a variant of a function as suggested in the comments of the manual page of is_writable on php.net)
// Replacement function for the standard php is_writable because of bugs in Windows
//
// From comments on the manual page of is_writable
//
// Since looks like the Windows ACLs bug "wont fix" (see http://bugs.php.net/bug.php?id=27609) I propose this alternative function:
//
function _is_writable($path) {

    if (is_dir($path) || $path{strlen($path)-1}=='/')
        return _is_writable($path . ($path{strlen($path)-1}=='/' ? "" : "/") . uniqid(mt_rand()).'.tmp');

    if (file_exists($path)) {
        if (!($f = @fopen($path, 'r+')))
            return false;
        fclose($f);
        return true;
    }

    if (!($f = @fopen($path, 'w')))
        return false;
    fclose($f);
    unlink($path);
    return true;
}

Please Connexion or Create an account to join the conversation.

Moderators: ronmjultenJohnSmith
Time to create page: 0.050 seconds
Copyright © 2024 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search