marcus

wireshell - an extendable ProcessWire command line interface

149 posts in this topic

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 :/

2 people like this

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

2 people like this

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) !

9 people like this

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.  :)

3 people like this

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.

4 people like this

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
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

 

 

1 person likes this

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
10 people like this

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 Martin Muzatko
      Hello!
      I'm trying to use the data I create in Processwire as much as possible.
      So for a form, I try to use the fields description, name and also its built-in validation rules I defined in ProcessWire on the front-end. (minlength, ranges, patterns, etc)
      I already looked into this tutorial, but it is using external resources to validate the form.
      Since ProcessWire does all the heavy lifting, when processing data, I don't have to sanitize anything - ___processInput should do the job just fine.
      However, it is not actually working correctly. 
      $fields = $templates->get('user')->fields; $submission = $input->post; foreach ($submission as $key => $value) { $field = $fields->{$key}; if ($field instanceof Field) { $field = $field->getInputfield($user); $field->___processInput(new WireInputData([$key => $value])); var_dump($field->getErrors(true)); // retrieve validation error } } This works for some constraints, but the values are not correctly validated.
      Example: 

      All the fields are required and zip is an integer field.
      Yet, I get no validation error for zip, although it was entered as a string, and not an integer. Funny enough: if I provide a number outside the range, I get "Specified value 2 removed because it is out of bounds (min=1000, max=99999)".
      firstname will not return any error for being a required field.
      From what I have looked through the source code, there is no check for "required". Some fields only validate on setAttribute. Am I missing anything or am I doomed to build my own validation process?
      Thank you in advance!
      Best,
      Martin
    • By bmacnaughton
      Do any experts have experience with the level of stability and/or support for turning on $config->advanced? I ask because of the warning at the bottom of the System tab "Please note that all of these system settings are intended for ProcessWire system development (not site development). Use them at your own risk."
      It provides two facilities that are invaluable to me (maybe because I don't know how to do them any other way).
      1) Disable Settings Tab on a per template basis
      2) Page Class Name - this makes it tweak a page while relying on the underlying Page class for the majority of functions.
      Are others using this setting in production? Have you used it over an extended time and seen that it is not changed often or at all?
    • By bmacnaughton
      I have a Page Table field that, for new entries, I want to construct the name for.
      When I click the Add New button the page being added has already been given a random name like: 20170422-003744.
      I wish to
      1) change that name so it's obvious it is a temporary name
      and 
      2) when either Publish or Save + Keep Unpublished is clicked, set the name of the page based on the content entered.
      What hooks can I use to accomplish 1 and 2?
       
      thanks.
       
    • By bmacnaughton
      I'm trying to create a pagename (for internal use, not for presentation to the users) with multiple dashes in the middle. Here's an excerpt of my code:
      $p = new Page(); $p->template = 'template-name'; $p->name = "$prod--$variation"; ProcessWire seems to apply $sanitizer->pageName($name, true) which converts multiple dashes to a single dash so the page name doesn't have "--" in it.
      How can I force it to have multiple dashes?
       
       
    • By timothy.m.wilson
      Good afternoon,
      I am attempting to loop through approximately 600 XML nodes. Each of those nodes has 2 child nodes (example below). One is an id for an existing page and the other contains values for a page reference field. I have put together a loop (below as well) to attempt to save each page with the label values. This all works....once. After getting the first XML node "label" saved to the correct page, nothing else is saved. I'm sure there is probably something that I have overlooked. But, I am also very new to this CMS. I'm hoping there is a veteran user who may be able to point me in the right direction. 
       
      <row>
          <id>1041</id>
          <labels>lifestyle|savings</labels>
        </row>
       
      foreach ($xml->row as $items) {
              
              //get page id to update and set output formatting to false
              $blog_page = $pages->get('id='.$items->id);
              $blog_page->of(false);
              //create array from pipe separated label values
              $labelsArray = explode('|', $items->labels);
              //loop through array to get page ids by page name
              $labelIDS = array();
              foreach ($labelsArray as $labelValue) {
                  $labelPage = $pages->get('name='.$labelValue);
                  array_push($labelIDS, $labelPage->id);
                  
              }
              //add labels to label field in post
              $blog_page->labels = $labelIDS;
              
              //save page
              $blog_page->save();
          
      }