marcus

wireshell - an extendable ProcessWire command line interface

Recommended Posts

Unfortunately no estimated time of arrival on my side, feeling sickly for a couple of weeks now, and drowning in customer work. Can't allocate time. Sorry :/

  • Like 2

Share this post


Link to post
Share on other sites

@marcus,

No problem, thank you for your time on this and for your reply; I hope you feel better soon.

Regards,

Steve

  • Like 2

Share this post


Link to post
Share on other sites

I'm in the process of getting wireshell PW3 ready. But I think it could use a bit more testing before I'll finally push it into the master branch. So I started a RC branch just for this purpose. If someone wanted to try and test it – which I would really appreciate: here you go (or: checkout branch feature/devns) !

  • Like 9

Share this post


Link to post
Share on other sites

I tried almost every command, but haven't noticed any issues with PW3. Maybe some of the heavy users will notice something.

Thank you for this awesome CLI.  :)

  • Like 3

Share this post


Link to post
Share on other sites

Since I didn't see it mentioned in any changelogs, I just want to give a heads up to the new ability to import field values via JSON files, which @justb3a implemented in top notch quality after my fiddly proof-of-concept patch :) . I find this to be a major improvement, since it enables so much easier import of data from e.g. Drupal, so just wanted to make you all aware of it.

I have outlined in very broad broad terms how I went about transferring data from a Drupal 7 site, to processwire, in this post.

  • Like 4

Share this post


Link to post
Share on other sites

Battling to install devns:

  [RuntimeException]
  Error loading sha `devns`, curl request failed (status code: 0,
   url: https://raw.githubusercontent.com/ryancramerdesign/Proces
  sWire/devns/wire/core/ProcessWire.php).
  cURL error: SSL certificate problem: unable to get local issuer
   certificate

Any ideas? (Going to do manual method for now.)

Share this post


Link to post
Share on other sites

Good day!

I am playing with the new command and finding some inconsistencies:

  1. If something went wrong while installing, like wrong db credentials were provided, there is no way to start over again without downloading the whole repo once again. Should there be a --no-download flag or something like that. The best thing is to make it check the db connection before the download process or even make it interactive and allow reenter the db credentials?
  2. Even with a db connection error I still get this untruthful message in the end: Congratulations, ProcessWire has been successfully installed.
  3. It would be nice if a new db could be attempted to create if there is not one already.
  4. I still get an error in the end :(
    PHP Fatal error:  Class 'WireDatabaseBackup' not found in C:\Users\dxlab1\AppData\Roaming\Composer\vendor\wireshell\wireshell\src\Helpers\Installer.php on line 486

     

Share this post


Link to post
Share on other sites

I tried out wireshell and installed it. It seems to work but not when I try to use it on a existing local install. PW Version doesn't matter so far. I'm using MAMP Pro and can't get it to work and always get an error.

When using the mysql socket as explained I get:

Error: Exception: SQLSTATE[HY000] [2002] No such file or directory (in /Applications/MAMP/htdocs/pw28.ch/wire/core/ProcessWire.php line 293)

When using the "allow network access" option in MAMP and using 127.0.0.1 I get:

Error: Exception: SQLSTATE[HY000] [2002] Connection refused (in /Applications/MAMP/htdocs/pw28.ch/wire/core/ProcessWire.php line 293)

I'm not sure what to try.

 

Share this post


Link to post
Share on other sites

Hi Soma,

which version of MAMP do you use (3.5)? It's very hard to say what is failing here since my wireshell/MAMP experience is limited to two systems (both El Capitan).

Best,

marcus

 

Share this post


Link to post
Share on other sites
5 minutes ago, marcus said:

Hi Soma,

which version of MAMP do you use (3.5)? It's very hard to say what is failing here since my wireshell/MAMP experience is limited to two systems (both El Capitan).

Best,

marcus

 

Yes MAMP Pro 3.5 on ElCapitan.

Share this post


Link to post
Share on other sites
2 minutes ago, Soma said:

Yes MAMP Pro 3.5 on ElCapitan.

Hm. Same here, and working with the 127.0.0.1/"allow network access" thing. Have you tried szabesz' suggestion?

Share this post


Link to post
Share on other sites

I'm not sure I want to follow what is written there, renaming php doesn't even work. And I dont' want to modify .bash_profile.

Share this post


Link to post
Share on other sites

It's kinda weird I'm now again trying to use the MAMP options to allow network access. I removed the socket configs I did in mysql and php but mysql log says 

160830 15:37:00 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
160830 15:37:02 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
160830 15:37:02 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
160830 15:37:02 [Note] Plugin 'FEDERATED' is disabled.
160830 15:37:02 InnoDB: The InnoDB memory heap is disabled
160830 15:37:02 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160830 15:37:02 InnoDB: Compressed tables use zlib 1.2.3
160830 15:37:02 InnoDB: Initializing buffer pool, size = 128.0M
160830 15:37:02 InnoDB: Completed initialization of buffer pool
160830 15:37:02 InnoDB: highest supported file format is Barracuda.
160830 15:37:02  InnoDB: Waiting for the background threads to start
160830 15:37:03 InnoDB: 5.5.42 started; log sequence number 6123988935
160830 15:37:03 [Note] Server hostname (bind-address): '127.0.0.1'; port: 8889
160830 15:37:03 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
160830 15:37:03 [Note] Server socket created on IP: '127.0.0.1'.
160830 15:37:03 [Note] Event Scheduler: Loaded 0 events
160830 15:37:03 [Note] /Applications/MAMP/Library/bin/mysqld: ready for connections.
Version: '5.5.42'  socket: '/Applications/MAMP/tmp/mysql/mysql.sock'  port: 8889  Source distribution

Weird thing is that there's no file : '/Applications/MAMP/tmp/mysql/mysql.sock'  in my case. never was.

Share this post


Link to post
Share on other sites
23 minutes ago, Soma said:

I'm not sure I want to follow what is written there, renaming php doesn't even work. And I dont' want to modify .bash_profile.

The cause of the error was this "N98 will be trying to use your Macs native PHP which isn't configured for MAMP's MySQL resulting in the database errors."

N98 is a phar file, just like wireshell. This worked for me:

Change directory to /usr/bin
cd /usr/bin
Change the name of the native php to keep a backup (just incase)
sudo mv php php.old
Create a symlink to your php version
sudo ln -s /Applications/MAMP/bin/php/php.[VERSION]/bin/php php

You can redo this, so you might want to try it just to see what happens.

Edited by szabesz
missing word "is"

Share this post


Link to post
Share on other sites

@szabesz It doesn't allow me to rename "php" to "php.old".

Share this post


Link to post
Share on other sites
4 minutes ago, Soma said:

@szabesz It doesn't allow me to rename "php" to "php.old".

Maybe because of System Integrity Protection

eg.: http://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html

The mac I use for development is still running Yosemite, so I have not yet tried to apply this change on El Capitan. Note, that I use this change for wp-cli too (so, still on Yosemite).

Share this post


Link to post
Share on other sites

 

3 minutes ago, szabesz said:

Note, that I use this change for wp-cli too (so, still on Yosemite).

I even made a bash script to hack it:

Spoiler

#!/bin/bash
# This script swaps the system default php binary for MAMP's version or vice versa

set -e
date
START="\e[0;95m :: \e[0m"
BLED="\e[0;36m :: \e[0m"
RLED="\e[0;41m :: \e[0m"
GLED="\e[0;47m :: \e[0m"
DONE="\e[0;42m :: \e[0m"

VERSION="php5.4.34"

ls -la /usr/bin/php*
if [ ! -f  /usr/bin/php.original ]; then
    printf "$START The file called php.original is NOT found!\n"
    printf "$BLED Do you want to switch to MAMP $VERSION? (y/n): "
    read ANSWER
    if [ "$ANSWER" = "y" ]; then
        cd /usr/bin
        sudo mv php php.original
        sudo ln -s /Applications/MAMP/bin/php/$VERSION/bin/php php
        printf "$BLED PHP is symlinked to MAMP $VERSION\n"
    else
        printf "$RLED You DID NOT choose yes! Nothing has been changed.\n"
    fi
else 
    printf "$START The file called php.original IS found!\n"
    printf "$BLED Do you want to switch to system version? (y/n): "
    read ANSWER
    if [ "$ANSWER" = "y" ]; then
        cd /usr/bin
        sudo rm php
        sudo mv php.original php
        printf "$BLED Original system PHP is restored.\n"
    else
        printf "$RLED You DID NOT choose yes! Nothing has been changed.\n"
    fi
fi
ls -la /usr/bin/php*

printf "$DONE We have reached the end of the script!\n"

date
exit 0

 

 

  • Like 2

Share this post


Link to post
Share on other sites

wireshell 1.0.0  :)

Compatibility: ProcessWire 3.x

  • Prepares wireshell for ProcessWire 3.x, adds namespace support, only supports ProcessWire 3.x
  • Updates Github Repository: github.com/processwire/processwire
  • Improves module:upgrade command, if no argument is provided it just checks for upgrades
  • Extends new command, adds option --src=path/to/source to be able to use a pre-downloaded tgz/zip/folder
  • Extends status command, only shows database password if --pass option is provided, shows if an upgrade is available
  • Updates upgrade command, removes options dev and devns
  • Like 10

Share this post


Link to post
Share on other sites

Hey guys, great work on all of this! I really like having this option.

However, while testing the 1.0.0 version [Edit: On macOS Sierra 10.12] I ran into an issue with creating a new project using a zipped site profile: It seems Wireshell fails at extracting the profile zip due to incorrect permissions? (I did not use any older version before so I do not know if this is a new problem).  

I have exported a site profile using Ryans Site Profile Export module, and have confirmed this works on a new PW 3.0.35 project: when I set it up manually (downloading & unpacking the PW zip, unpacking my profile zip into the folder and going through manual installation of the project) everything works fine. 

Also I can create new projects using the built-in profiles correctly (ie. `wireshell new projectname --profile=blank` etc).  To be sure I even checked if I could sudo run the script but to no avail (bad idea anyway). 

Below is the (truncated) result:

weps:Server eelke$ wireshell new thijmentest2 --verbose --profile=ProjectGenerator/site-ember-pw-profile.zip


 Downloading ProcessWire...
   10.21 MB/10.21 MB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  100%

 Preparing project...

 Extracting profile...

[2016-10-03 08:39:59] name.ERROR: Error: Directory /Users/eelke/Documents/Werk/Server/thijmentest2/site/assets/ must be writable. Please adjust the permissions before continuing. [] []
[2016-10-03 08:39:59] name.ERROR: Error: File /Users/eelke/Documents/Werk/Server/thijmentest2/site/config.php must be writable. Please adjust the permissions before continuing. [] []
[2016-10-03 08:39:59] name.ERROR: One or more errors were found above. We recommend you correct these issues before proceeding or contact ProcessWire support if you have questions or think the error is incorrect. But if you want to proceed anyway, click Continue below. [] []

(.. Wireshell project settings ..) 

[2016-10-03 08:40:51] name.ERROR: Please fix the error to further proceed [] []

Congratulations, ProcessWire has been successfully installed.
weps:Server eelke$

As a result, the entire installation fails. After running the script, the database is empty and this is the folder structure:

Schermafbeelding 2016-10-03 om 09.10.52.png

Any ideas?

Edit: Definitely a problem with unzipping files. Very simple command:

Schermafbeelding 2016-10-04 om 13.41.43.png

It seems to be macOS Sierra related, accidentally I ran into a same kind of problem this morning doing some Homebrew tasks.
(https://github.com/caskroom/homebrew-cask/pull/22002

The signature of Zip files has changed apparently. 
Running 'file -Izb -- ~/Server/ProjectGenerator/processwire-master.zip' on OS X 10.11 yields:

application/x-empty compressed-encoding=application/zip; charset=binary; charset=binary

But on macOS 10.12 all you get is:

application/zip; charset=binary


 

 

Share this post


Link to post
Share on other sites

This has nothing to do with the signature of the zip file. The zip file has not the right permissions to be extracted. Please change the owner (user) of the zip file.

As stated in the error message: ..or because the installer doesn't have enough permissions to uncompress and rename the package contents.

works for me:
-r-x------ 1 username staff 11M Oct 6 12:39 pw.zip

leads to the error message ProcessWire can't be installed because...:
-r-x------ 1 100 staff 11M Oct 6 12:39 pw.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By louisstephens
      I am wondering, how do you pass a variable into wire('page')->get() inside a function? I have been looking through the forums, but unfortunately I have not found the answer yet.
      My current set up is:
      function generateNewPages($parentPageName) { $p = new Page(); $p->template = "parent"; $p->parent = wire('pages')->get('/home/'); $p->name = $parentPageName; $p->title = $parentPageName; $p->of(false); $p->save(); $p2 = new Page(); $p2->template = "child"; $p2->parent = wire('pages')->get('$parentPageName'); $p2->name = "child"; $p2->title = "Child Page"; $p2->of(false); $p2->save(); } When I try to run it by passing in a title like generateNewPages('Demo');, "Demo" is created, but when it gets to the child page I get:
      Unknown Selector operator: '$' -- was your selector value properly escaped?
      Is there a way to pass the $parentPageName to "wire('pages')->get('$parentPageName')" ?
    • By thomasaull
      I recently started to build Vue SPAs with ProcessWire as the backend, connected with a REST API. Thanks to code and the help of @LostKobrakai (How to use FastRoute with ProcessWire) and @clsource (REST-Helper) I got it up and running pretty quickly and now have put all of it in a site profile for others to use. It includes the REST API with routing for different endpoints, JWT Auth and a simple Vue SPA which shows the process of logging in a user (nevertheless, you don't have to use the Vue part, the API will work on it's own).
      Check it out here: https://github.com/thomasaull/RestApiProfile
      I'm pretty sure, it's not the perfect or most sophisticsted solution, but it gets the job done for me…
      Feedback or Improvements are very welcome
      Update: This site profile is a module now: https://github.com/thomasaull/RestApi
    • By Pixrael
      I have a technical question that maybe you can guide me to a solution/idea.
      I know an online tool that publishes product information and updates prices/inventories regularly from marketplaces such as Amazon, Ebay, etc. to a Wordpress website ... can get the orders information, auto-order it and send back the tracking numbers. All this is done through the Woocommerce API. They don't have an API or CSV option to access this features..
      Is it possible to create fake REST endpoints (a clone of WooCommerce) on my site to accept requests from that external website and process this data my way inside PW? The requests to a REST endpoint are POST like in regular forms submits?
      Sorry I don't have to much technical background about this
      https://woocommerce.github.io/woocommerce-rest-api-docs/?php#create-a-product https://woocommerce.github.io/woocommerce-rest-api-docs/?php#update-a-product https://woocommerce.github.io/woocommerce-rest-api-docs/?php#retrieve-an-order
    • By Xonox
      Hi,
       
      I'm trying to upload images from a folder into a page. I need to replace the images instead of adding. The image field already has the replace existing images turned on, but it doesn't seem to be enough.
       
      My code:
      foreach($files as $file) { if(substr($file, 0, 1) != '.' && $file != '.' && $file != '..') { // Get SKU $file_sku = substr($file, 0, 9); // Check for book $book = $pages->get('sku=' . $file_sku); if(!$book->id) { // Book doesn't exist } else { // Upload image into book !!! THIS CODE ADDS FILE INSTEAD OF REPLACING. HOW CAN I REPLACE? $book->book_images->add($upload_directory . '/' . $file); // Delete file unlink($upload_directory . '/' . $file); } // Save book if($book->id) $book->save(); } }  
      What am I missing?
    • By louisstephens
      I have a repeater with a text field where I would like to use hanna code (to make it easier on the user) so the user can define the action of a image that is in the repeater. For example:
      1. The image should have an external link:
      - the user can just type in the url
      2. The image, when clicked, should be printable (using print.js)
      - the user can just type [[print_image]]
      That works just fine, but I am running into an "issue". The code I need to use to print is:
      onclick="printJS({printable: 'path_to_image', type: 'image'});" I can put that into the hanna code as plain text, but I have no idea how to get the image from the repeater item and pass to "path_to_image". Is this even possible?