• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    PHP 5.4 & FOG 0.32

    Scheduled Pinned Locked Moved
    FOG Problems
    3
    7
    3.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      Olaf
      last edited by

      Dear community,

      FOG 0.32 uses depreciated PHP code which is the reason why the TaskManager service will not run/crashes on current Linux distributions like Fedora 17, Ubuntu 12.10, Debian Wheezy.
      The problem is: [url]http://php.net/manual/en/language.references.pass.php[/url]

      Below is an [U][I][B]untested[/B][/I][/U] potential solution. Any feedback most appreciated. I simply do not have the time to test this thoroughly. Would not be too surprised if the graphics part will not work as expected. A solution for that might be to upgrade the library ( jpgraph in /var/www/fog/management/lib ) to a more current version.
      Consider testing this on a testsetup and NOT on a production network/server!

      The script below makes a backup of your FOG installation (the www part) by ZIPing it and next replaces all occurrences of “&$” with “$”. It is executed with a single argument: the directory where it can find FOG. On Debian/Ubuntu: /var/www/fog

      [CODE]#!/bin/bash

      inspired by: http://unix.stackexchange.com/questions/46839/how-to-find-and-replace-files-contents-that-match-a-pattern

      MYDIR=$1

      if [ -d “$MYDIR” ] ; then
      TOPDIR=$(basename “$MYDIR”)
      if [ $TOPDIR == “fog” ] ; then
      # seems to be ok, so get on with it

      # make a backup first
      echo "Making a backup first...."
      tar -zcf "$MYDIR/../fog_preup_backup.tgz" $MYDIR
      echo "Backup made."
      
      # do my thing
      echo "Start search and replace"
      FINDPATTERN="&\\$"
      REPLACEPATTERN="$"
      
      ACTION="find $MYDIR -name '*.php' -print0 | xargs -0r sed -i -e 's/$FINDPATTERN/$REPLACEPATTERN/g'"
      echo "To be executed: $ACTION"
      eval $ACTION
      
      #find Project -name '*.php' -print0 | xargs -0r sed -i -e 's/&\$/$/g'
      #find $MYDIR -name '*.php' -print0 | xargs -0r sed -i -e "s/$FINDPATTERN/$REPLACEPATTERN/g"
      #find $MYDIR -name '*.php' -exec sed -i 's/$FINDPATTERN/$REPLACEPATTERN/g' {} +
      
      echo "Finished"
      

      else
      echo “Most likely the directory you specified is not a directory where FOG was installed.”
      exit 1
      fi
      else
      echo “Given argument is not a directory.”
      exit 1
      fi
      [/CODE]

      1 Reply Last reply Reply Quote 0
      • O
        Olaf
        last edited by

        I can confirm as of last week that this patch is not working. FOG will be unable to execute tasks. Pity.

        1 Reply Last reply Reply Quote 0
        • C
          chad-bisd Moderator
          last edited by

          There are at least 4 threads on these forums about this issue, with the exact file name and command to run to fix it.


          If you would like to make a donation to the Fog project, please do so [U][COLOR=#0000ff][URL='http://sourceforge.net/dona…

          1 Reply Last reply Reply Quote 0
          • O
            Olaf
            last edited by

            afaik all these threads you refer to are about “search and replace” with a texteditor in a specific file.
            However if you grep the entire FOG installation regarding this issue you will find it scattered over 20 files. Most of them are jpgraph related so they can be ignored as long as you do not use the reporting functionality I presume. So there are 5 files with issues left. Above patch is not different to a manual search and replace.
            But please prove me wrong as currently I ended up with a non functioning FOG server.
            Releasing an “official” patch or intermediate release (0.32.1 or something) with this issue resolved would be helpful for those with Linux boxes more recent than 2 years or so.
            I did not want to reinvent the wheel, but a script seemed easier than manually editing files. Hence my attempt.

            1 Reply Last reply Reply Quote 0
            • C
              chad-bisd Moderator
              last edited by

              I agree it would be nice to have a patch or intermediate release, but FOG does not do either. The only place that I’ve found this problem to really hinder the daily use of FOG 0.32 is in the task scheduling screen, which appears blank in the main body. This issue has been resolved by replacing the &$tmp variables in the function calls in the one file mentioned in those threads. You do NOT want to replace the &$tmp in the function definitions, only in the calls. It appears the script you posted above does not take this into consideration and it may break FOG.

              When I researched this issue for the original help request, I found only the 1 file that used pass-by-reference in the function calls. All the other instances of &$ were in the function definitions iirc.


              If you would like to make a donation to the Fog project, please do so [U][COLOR=#0000ff][URL='http://sourceforge.net/dona…

              1 Reply Last reply Reply Quote 0
              • N
                noctitep
                last edited by

                [quote=“chad-bisd, post: 11610, member: 18”]When I researched this issue for the original help request, I found only the 1 file that used pass-by-reference in the function calls. All the other instances of &$ were in the function definitions iirc.[/quote]

                Well, there is just another one in “management/lib/Group.class.php”.

                [PHP]if ( $host->startTask($conn, $tasktype, $blShutdown, $port, $mcId, null, null, null, &$ireason) )[/PHP]
                should be replaced by
                [PHP]if ( $host->startTask($conn, $tasktype, $blShutdown, $port, $mcId, null, null, null, $ireason) )[/PHP]

                All other pass-by-reference variables are in “management/includes/tasks.confirm.include.php”.

                1 Reply Last reply Reply Quote 0
                • C
                  chad-bisd Moderator
                  last edited by

                  thanks for finding that one.


                  If you would like to make a donation to the Fog project, please do so [U][COLOR=#0000ff][URL='http://sourceforge.net/dona…

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post

                  228

                  Online

                  12.0k

                  Users

                  17.3k

                  Topics

                  155.2k

                  Posts
                  Copyright © 2012-2024 FOG Project