marcus

wireshell - an extendable ProcessWire command line interface

Recommended Posts

marcus    537

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
netcarver    1,877

@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
justb3a    618

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

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

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
Mike Rockett    961

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
Ivan Gretsky    804

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
Soma    6,126

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

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
Soma    6,126
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
marcus    537
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
Soma    6,126

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
Soma    6,126

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
szabesz    1,377
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    1,377
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
szabesz    1,377

 

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 1

Share this post


Link to post
Share on other sites
justb3a    618

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

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

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 celfred
      Hello,
      Just a simple (I think) question which is in the title of my post.
      Roughly speaking : here's my code (made-up because my real function is so long... I don't want to post it all here )

      function updateScore($player, $task, $real = true) { [...] $player->score = $player->score+$task->score; if ($task->name == 'new-equipment') {   $new-eq = $pages->get("name=sword");   $player->equipment->add($new-eq); } if ($real == true) {   $player->save(); } }
      Everything works fine when I call updateScore($player, $task, true), but if I call updateScore($player, $task, false), scores are untouched, but the equipment gets added !
      It used to work fine on PW2.7 but my update to PW 3.0.62 seems to have broken this... Is there a simple explanation ? I keep reading my code over and over and this is driving me crazy...
      Thanks !
    • By zaib
      I've a page "blog" which have child pages (blog posts). Right now I've 11 pages (blog posts) and I'm fetching all the posts in my "blog" pages which displaying fine, Issue is only 10 results are showing this is how I'm fetching
      $entries = $pages->find("template=blog-entry"); foreach($entries as $entry){ <a href='{$entry->url}'>$entry->title</a> }  
    • By pppws
      hey there,
      i'm quite new to processwire but i'm having a great experience using it!
      right now i hit a point where i can't help myself out with google/searchfunction.
       
      to sketch the basic functions of my page:
      visitors can enter their e-mail in a form. when doing this pw creates a new page, using the e-mail's md5 hash as a name. the url of the page is sent to the user. the user now can edit the newly created page and can fill out fields like: name and year of birth (thanks to the docs those two already work like a charm!) but there are other fields like "residencies", which are repeaterfields containing three fields: city (text), country (text), current (checkbox). at my current version i can populate a new repeater field easily by using this code:
      $location = $page->locations->getNew(); $location->location = Munich; $location->country = Germany; $location->current = 1; $location->save(); $page->locations->add($location); now i want to populate the new reapter fields from input fields (using the simple form api). which leads me to my questions:
       
      1. can i somehow group/merge input fields to one "repeater input fields" right now i have:
      // create a text input -> locations $field = $modules->get("InputfieldText"); $field->label = __('City'); $field->attr('id+name','location'); $field->required = 1; $form->append($field); // append the field to the form // create a text input -> country $field = $modules->get("InputfieldText"); $field->label = __('Country'); $field->attr('id+name','country'); $field->required = 1; $form->append($field); // append the field to the form // create a checkbox -> locations $field = $this->modules->get('InputfieldCheckbox'); $field->attr('name', 'location_current'); $field->attr('autocheck', 1); $field->attr('uncheckedValue', 0); $field->attr('checkedValue', 1); $field->attr('value', $this->fname); $form->append($field); // append the field to the form 2. my desired layout for the form looks like this:

      by hitting the + button a new line shows. i'm wondering what's the best practice here. can is somehow use the above mentioned code itself as a repeater, or do i have to create several (uniqe) input fields in advance and hide them afterwards (javascript)?
       
      any help is appreciated!
      thanks!
    • By alexcapes
      Hi,
      I've been invited by Apple to use their 'News' service for a publication in the UK. https://www.apple.com/uk/news/
      A number of CMSs already have plugins to publish content via the API, however Processwire is not one (yet!)
      https://newsresources.apple.com/en/faq/66346243
      It's slightly beyond my technical abilities but would be very interested in anyone that is willing to look at developing a Processwire Module.
      (for reference here is the Apple News API documentation)
      Update: Chapter Three have created a PHP Apple News library here https://github.com/chapter-three/AppleNewsAPI
    • By louisstephens
      So I have a bit of code for ad management :
      <?php $ads = $pages->find("parent.template=client, sort=expiration_date"); $alert_count = 0; foreach ($ads as $ad) { $todaysdate = date("F j, Y H:i"); $today = strtotime($todaysdate); $expireson = $ad->expiration_date; $expires = strtotime($expireson); $fiveaway = $expires - 432000; if ($today > $expires) { $alert = $alert_count=+1; echo $alert; } } //end FOREACH ?> It currently finds all the pages with a parent of "client" and then I can drill down to the pages that have "Expired" in my if statement. I wanted to get a "count" of the pages that met the if statement requirements so I could output that number in an alert at the top of the page. When it runs, it currently just prints out "1 1 1 1..." and not the total count of pages. Does anyone know of a way possibly achieving my desired output? I tried count(), but that did not quite produce my desired output.
       
      I should note that I have several other if statements dealing with the date/time for outputting other alerts as well (just didn't think they were needed for this case).