Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

PI-676 updated installer to download correct php version #101

Merged
merged 1 commit into from
Jul 21, 2016

Conversation

thellimist
Copy link
Contributor

No description provided.

@@ -208,11 +208,15 @@ install $SOURCE_DIR/APIKey $INSTALL_DIR/bin/admin/CloudFlare/APIKey
chmod 0700 $INSTALL_DIR/bin/admin/CloudFlare/APIKey
echo "mode=simple" > $INSTALL_DIR/bin/admin/CloudFlare/APIKey.conf

# Get PHP Version
CPANELSUPPORTEDPHPPATH=`ls -al $INSTALL_DIR/3rdparty/bin/php | awk '{print $11}'`
PHPVERSION=`echo $CPANELSUPPORTEDPHPPATH | rev | cut -d '/' -f 3 | rev`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

#!/bin/bash
IN="/usr/local/cpanel/3rdparty/php/56/bin/php"
IFS="/" && Array=($IN)
PHPVERSION=${Array[6]}
echo $PHPVERSION

http://stackoverflow.com/questions/918886/how-do-i-split-a-string-on-a-delimiter-in-bash

This rev, cut, rev logic scares me because I don't know bash and if they change the path its not clear how to fix.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a one liner which will get you the PHP version in the format you want:
PHPVERSION=/usr/local/cpanel/3rdparty/bin/php --version | head -1 | awk '{print $2}' | sed 's/.//' | cut -f 1 -d .``

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was hoping for something a little more human readable haha :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwineman That doesn't work. In my opinion rev logic is clear enough. I can add comment to be more clear though?

@jwineman jwineman merged commit 29f0d36 into master Jul 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants