Skip to content
This repository was archived by the owner on Mar 30, 2024. It is now read-only.

Commit 6c62113

Browse files
committed
PHP 8 and MacOS TTTd.app fixes
1 parent 204aba0 commit 6c62113

File tree

8 files changed

+96
-37
lines changed

8 files changed

+96
-37
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ We have tested it under Linux Mint 18, macOS Catalina and Windows 10.
107107
We have an install and update script for macOS and Linux – [`install.sh`](install.sh).
108108

109109
The script will follow these steps (for detailed information per operating system see below).
110-
1. Check the installation of PHP 7.4
110+
1. Check the installation of PHP (version 7.4 or newer)
111111
2. Ask the user where to install
112112
3. Use git to download the programs repository
113113
4. Add the `ttt` command to the shell
114114
5. Create an background job if on Linux
115115

116116
### Manual Installation
117-
1. Install PHP 7.4 (only the CLI component is needed)
117+
1. Install PHP 7.4 or newer (only the CLI component is needed)
118118
- On Linux install `yad` for dialogs
119119
- On Windows PHP-GTK will be used (and downloaded on first run of `./cli.php r`)
120120
- On macOS the dialog is a native program bundle shipped in this repository
@@ -156,7 +156,7 @@ The install script registers the `ttt-update` command (which reruns `install.sh`
156156
`sudo apt-get install yad`
157157
#### macOS
158158
- PHP 7.4
159-
- Until now PHP 7.3. is part of macOS, so `/usr/bin/php` will not work!
159+
- Only PHP 7.3. is part of macOS, so `/usr/bin/php` will not work!
160160
- Install Homebrew https://brew.sh/index
161161
- Install `brew install php` or `brew install [email protected]`
162162
- PHP will be installed to `/usr/local/Cellar/[email protected]/*/bin/php` or `/usr/local/Cellar/php/*/bin/php`
@@ -168,8 +168,8 @@ The install script registers the `ttt-update` command (which reruns `install.sh`
168168
- The repository contains an `TTTd.app` it will start `record.php` as background process
169169
- `TTTd.app` will only work, if you use Homebrew for the PHP installation
170170
- Also `TTTd.app` looks for TTT at `~/Applications/TaskTimeTerminate/`
171-
- Create own Automator Application instead of `TTTd.app`
172-
- Open Automator.app and open a new Program
171+
- Create own Automator Application as alternative to provided `TTTd.app`
172+
- Start Automator.app and open a new Program
173173
- Select *Execute Shell Command* and `/bin/sh` as Shell
174174
- Add a command like this in the textbox on the right
175175
- `/usr/local/Cellar/php/*/bin/php /Users/<me>/Applications/TaskTimeTerminate/record.php &> /dev/null &`
@@ -181,7 +181,7 @@ The install script registers the `ttt-update` command (which reruns `install.sh`
181181
- Add to `$PATH` or always run like `C:/my/php/path/php.exe C:/Users/<me>/TaskTimeTerminate/cli.php`
182182
- Enable the extension `sockets` (for autocompletion of tasks in the dialog)
183183
- Edit `C:/my/php/path/php.ini` (create there if not existent) to load the extension (it is part of the prebuilt PHP version)
184-
- Make sure to have this two lines in it (i.e. remove `;` in from of each)
184+
- Make sure to have this two lines in it (i.e. remove `;` in front of each)
185185
```ini
186186
extension_dir = "ext"
187187
extension = "php_sockets.dll"

TTTd.app/Contents/Info.plist

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>AMStayOpen</key>
88
<false/>
99
<key>BuildMachineOSBuild</key>
10-
<string>19A603003</string>
10+
<string>19A603013</string>
1111
<key>CFBundleAllowMixedLocalizations</key>
1212
<true/>
1313
<key>CFBundleDevelopmentRegion</key>
@@ -60,11 +60,11 @@
6060
<key>DTPlatformName</key>
6161
<string>macosx</string>
6262
<key>DTPlatformVersion</key>
63-
<string>11.0.1</string>
63+
<string>11.1</string>
6464
<key>DTSDKBuild</key>
65-
<string>20B21</string>
65+
<string>20C62</string>
6666
<key>DTSDKName</key>
67-
<string>macosx11.0internal</string>
67+
<string>macosx11.1internal</string>
6868
<key>DTXcode</key>
6969
<string>1200</string>
7070
<key>DTXcodeBuild</key>
0 Bytes
Binary file not shown.

TTTd.app/Contents/_CodeSignature/CodeResources

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</data>
1111
<key>Resources/Assets.car</key>
1212
<data>
13-
wM6S0+6/Mly1+qq/QVfR5SW0Yrc=
13+
6x486X/RjFLUxX/nTxPBfMGbmCo=
1414
</data>
1515
<key>Resources/en.lproj/InfoPlist.strings</key>
1616
<dict>
@@ -39,11 +39,11 @@
3939
<dict>
4040
<key>hash</key>
4141
<data>
42-
wM6S0+6/Mly1+qq/QVfR5SW0Yrc=
42+
6x486X/RjFLUxX/nTxPBfMGbmCo=
4343
</data>
4444
<key>hash2</key>
4545
<data>
46-
AdGCOZF/5psqyrCHV5t3DhtFhEdGPJoUAyq50fYkkjk=
46+
LnTju/BZ3F2CTA9e2XgciGp8jYhtkX/ez4o9EBeChzA=
4747
</data>
4848
</dict>
4949
<key>Resources/en.lproj/InfoPlist.strings</key>
@@ -63,10 +63,10 @@
6363
<dict>
6464
<key>cdhash</key>
6565
<data>
66-
Z7Aih50fn6mzWKRPrt42SybctAo=
66+
dEpwdWqUYCU6HvGXM3CYyxnGNc4=
6767
</data>
6868
<key>requirement</key>
69-
<string>cdhash H"a13e2c29912070d3ad09828714973d8052e77d46" or cdhash H"67b022879d1f9fa9b358a44faede364b26dcb40a"</string>
69+
<string>cdhash H"f69436f95329fc55f0641c7c7eb27c62433ce321" or cdhash H"744a70756a9460253a1ef197337098cb19c635ce"</string>
7070
</dict>
7171
</dict>
7272
<key>rules</key>

TTTd.app/Contents/document.wflow

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,46 @@
5959
<key>ActionParameters</key>
6060
<dict>
6161
<key>COMMAND_STRING</key>
62-
<string>#!/bin/sh
62+
<string>#!/bin/bash
6363

64-
NOW=$(date +"%d.%m.%Y %T")
64+
# some settings
65+
curr_time=$(date +"%d.%m.%Y %T")
66+
daemon_log="/tmp/TaskTimeTerminateDeamon.log"
67+
search_path=(
68+
/usr/local/Cellar/php@7*/7.4*/bin/php
69+
/usr/local/Cellar/php@8*/*/bin/php
70+
/usr/local/Cellar/php*/*/bin/php
71+
)
72+
php_binary="php"
6573

66-
# brew path
67-
PHP=$(echo /usr/local/Cellar/php*/7.4*/bin/php);
68-
if ! "$PHP" -i | grep -q "7.4"; then
69-
PHP="php"; # alternative
70-
fi;
74+
# look for php
75+
for path in ${search_path[*]}
76+
do
77+
# get the path
78+
php_cand=$(echo $path);
79+
if [ -f "$php_cand" ]; then # check if exsists
80+
if [ $("$php_cand" -r "echo version_compare(PHP_VERSION, '7.4', '&gt;=') ? 'ok' : 'error';") = "ok" ]; then # check version
81+
php_binary="$php_cand" # remember found
82+
break;
83+
fi;
84+
fi;
85+
done
7186

7287
# final test
73-
if ! "$PHP" -i | grep -q "7.4" ; then
74-
echo "Unable to find PHP 7.4 using '$PHP' at $NOW" &gt;&gt; /tmp/TaskTimeTerminateDeamon.log;
88+
if [ $("$php_binary" -r "echo version_compare(PHP_VERSION, '7.4', '&gt;=') ? 'ok' : 'error';") = "error" ]; then
89+
echo "Unable to find PHP 7.4 or newer using '$php_binary' at $curr_time" &gt;&gt; $daemon_log;
7590
exit;
7691
fi;
7792

78-
echo "Starting with '$PHP' at $NOW" &gt;&gt; /tmp/TaskTimeTerminateDeamon.log;
79-
8093
# start background job
81-
"$PHP" ~/Applications/TaskTimeTerminate/record.php &amp;&gt; /dev/null &amp;</string>
94+
echo "Starting with '$php_binary' at $curr_time" &gt;&gt; $daemon_log;
95+
"$php_binary" ~/Applications/TaskTimeTerminate/record.php &amp;&gt; /dev/null &amp;</string>
8296
<key>CheckedForUserDefaultShell</key>
8397
<true/>
8498
<key>inputMethod</key>
8599
<integer>0</integer>
86100
<key>shell</key>
87-
<string>/bin/sh</string>
101+
<string>/bin/bash</string>
88102
<key>source</key>
89103
<string></string>
90104
</dict>
@@ -191,7 +205,7 @@ echo "Starting with '$PHP' at $NOW" &gt;&gt; /tmp/TaskTimeTerminateDeamon.log;
191205
<key>isViewVisible</key>
192206
<true/>
193207
<key>location</key>
194-
<string>309.000000:252.000000</string>
208+
<string>309.000000:598.000000</string>
195209
<key>nibPath</key>
196210
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/Base.lproj/main.nib</string>
197211
</dict>

core/Utilities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
class Utilities {
66

7-
const VERSION = 'v1.0.14';
7+
const VERSION = 'v1.0.15';
88

99
const DEFAULT_LINE_LENGTH = 125;
1010

core/platform/macos/TTTd.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# some settings
4+
curr_time=$(date +"%d.%m.%Y %T")
5+
daemon_log="/tmp/TaskTimeTerminateDeamon.log"
6+
search_path=(
7+
/usr/local/Cellar/php@7*/7.4*/bin/php
8+
/usr/local/Cellar/php@8*/*/bin/php
9+
/usr/local/Cellar/php*/*/bin/php
10+
)
11+
php_binary="php"
12+
13+
# look for php
14+
for path in ${search_path[*]}
15+
do
16+
# get the path
17+
php_cand=$(echo $path);
18+
if [ -f "$php_cand" ]; then # check if exsists
19+
if [ $("$php_cand" -r "echo version_compare(PHP_VERSION, '7.4', '>=') ? 'ok' : 'error';") = "ok" ]; then # check version
20+
php_binary="$php_cand" # remember found
21+
break;
22+
fi;
23+
fi;
24+
done
25+
26+
# final test
27+
if [ $("$php_binary" -r "echo version_compare(PHP_VERSION, '7.4', '>=') ? 'ok' : 'error';") = "error" ]; then
28+
echo "Unable to find PHP 7.4 or newer using '$php_binary' at $curr_time" >> $daemon_log;
29+
exit;
30+
fi;
31+
32+
# start background job
33+
echo "Starting with '$php_binary' at $curr_time" >> $daemon_log;
34+
"$php_binary" ~/Applications/TaskTimeTerminate/record.php &> /dev/null &

install.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/bin/sh
22

3-
# check for php 7.4
3+
# check for php
44
if ! command -v php > /dev/null; then
55
echo "PHP not found!";
6-
echo "Install PHP 7.4"
6+
echo "Please install PHP 7.4 or newer!"
77
exit;
88
fi;
99

10-
if ! php -v | grep -q "7.4" ; then
11-
echo "PHP is not version 7.4!"
10+
# check php-version
11+
if [ $(php -r "echo version_compare(PHP_VERSION, '7.4', '>=') ? 'ok' : 'error';") = "error" ]; then
12+
echo "TTT needs PHP version 7.4 or newer!"
1213
exit;
1314
fi;
1415

@@ -38,7 +39,7 @@ if [ ! -f ./record.php ]; then
3839
elif [ $(uname) = "Darwin" ]; then
3940
installpath="$HOME/Applications/TaskTimeTerminate";
4041
else
41-
echo "Only Linux and macOS supported!"
42+
echo "Only Linux and macOS supported by this script!"
4243
exit;
4344
fi;
4445
echo "Install to '$installpath'? Type other absolute path or enter to use suggested."
@@ -58,7 +59,7 @@ if [ ! -d $installpath ]; then
5859
fi;
5960
cd "$installpath";
6061
if [ ! $(pwd) = $installpath ]; then
61-
echo "Error creating installpath '$installpath' path!"
62+
echo "Error creating/ moving to installpath '$installpath'!"
6263
exit;
6364
fi;
6465

@@ -94,6 +95,16 @@ if [ -f ~/.zshrc ]; then
9495
fi;
9596
fi;
9697

98+
# setting up TTTd.app on macOS
99+
if [ $(uname) = "Darwin" ]; then
100+
if [ -d "$(pwd)/TTTd.app" ]; then
101+
if [ "$(xattr "$(pwd)/TTTd.app")" = "com.apple.quarantine" ]; then
102+
xattr -d com.apple.quarantine "$(pwd)/TTTd.app"
103+
echo "Removed quarantine lock on TTTd.app!"
104+
fi;
105+
fi;
106+
fi;
107+
97108
echo "========================================================="
98109
echo "TaskTimeTerminate by KIMB-technologies "
99110
echo " Installation/ Update successful! "
@@ -107,7 +118,7 @@ if [ $(uname) = "Linux" ]; then
107118
echo "[Desktop Entry]" > ~/.config/autostart/TaskTimeTerminate.desktop
108119
echo "Type=Application" >> ~/.config/autostart/TaskTimeTerminate.desktop
109120
echo "Name=TaskTimeTerminate" >> ~/.config/autostart/TaskTimeTerminate.desktop
110-
echo "Exec=$(command -v php7.4) $(pwd)/record.php" >> ~/.config/autostart/TaskTimeTerminate.desktop
121+
echo "Exec=$(command -v php) $(pwd)/record.php" >> ~/.config/autostart/TaskTimeTerminate.desktop
111122
echo "X-GNOME-Autostart-Delay=10" >> ~/.config/autostart/TaskTimeTerminate.desktop
112123

113124
echo "We have created an autostart into '~/.config/autostart/' "

0 commit comments

Comments
 (0)