Month: February 2019

HOW TO FIX YOUR SUITECRM GLOBAL SEARCH BY RE-INDEXING

Has your Suite CRM global search broken? I hear you. Hard times. I actually went through the entire process of upgrading our whole instance for about a month and after finishing all that, it turns out it was just this broken index! Good news is that the newer version of Suite CRM is about ten times more awesome so I’m glad I was forced to upgrade. But here’s the point – this tutorial might be all you need to fix your Suitecrm broken global search.

The problem is that if you are in a shared host environment like me and not very skilled it’s just downright scary to perform some of the tutorials I found. I had no choice but to give it a shot and thankfully it worked. Hopefully this tutorial will remove some of the fear for you that I had to go through.

First, as always, none of this would have been possible without all the history of awesome developers who put their code into the Suitecrm project. I will refer to a few specific folks but there are many others involved as with any free software proejct. To you we are all thankful and hopefully this tutorial helps others join the Suitecrm project.

Next, let’s talk about the task at hand

Before We Begin

I find it’s useful to look at the steps in a casual way before doing them. No one really does this in tutorials but I find it lowers stress levels when you approach each step. What we’re going to do here is just back up a few things so we don’t kill our crm forever if we make a mistake, rename a folder, learn a couple of new things in Phpmyadmin (some tool in Cpanel and elsewhere), delete a bunch of old rows in a database table that’s making your Global Search broken, and then tell Suitecrm to ‘start indexing afresh’. That’s it. So remember, ‘If Wayne can do it, you can do it too. Just take your time.

I am assuming that you are using a Cpanel shared hosting environment. If you aren’t, I’m guessing that you are probably smarter than me anyway and this tutorial will feel to baby-like. Feel free to skip to this tutorial here if that is you. Pretty much all of what I’m doing is from that but he didn’t explain a few things I simply couldn’t figure out online.

Step 0 – Advise Others Not to Use SuiteCRM

I always tell others to not use the crm when I do maintenance. Probably you should advise the same.

Step 1 – Back up your Whole Suite CRM instance

In theory you ‘could’ skip this step but I’ve learned it’s worth it. We’re only renaming one directory in this tutorial so if you are careful you could skip it. But since you probably need a recent backup anyway, why not do it?

  • a) Go to file manager
  • b) Go to your suite crm install folder and back it up. There are two ways to do it I’ve learned. You can compress it where it is with the Cpanel compress tool and then just download to your computer or, better, use an FTP tool and get it that way. Both work.

Step 2 – Back up your MySQL Database

Besides your files in Step 1, these database files are the other critical files to back up.

  • a) Go to ‘backup’ section of cpanel,
  • b) go to “Download a MySQL Database Backup”
  • c) select the database asssociated with your suitecrm and click it. If you don’t now what your database is, and you have a few, then there are two ways to figure it out:
  • if you installed by Softaculous, you can just search Suitecrm in the search field, find your install and then click the pencil icon to see the details which will show the database name
  • If you didn’t install it that way, you’ll have to find the Suitecrm directory in file manager, go into the directory, and then click the ‘view’ button after selecting the config.php file. Scroll down until you see a block that looks like this which will expose your info:

array (
‘db_host_name’ => ‘localhost’,
‘db_host_instance’ => ‘SQLEXPRESS’,
‘db_user_name’ => ‘yourdatabaseNAMEwillbehere’,
‘db_password’ => ‘randomPASSWORDwillbehere’,
‘db_name’ => ‘yourdatabaseUSERNAMEwillbehere’,
‘db_type’ => ‘mysql’,
‘db_port’ => ”,
‘db_manager’ => ‘MysqliManager’,
),

Now you have your database file safely saved on your machine as well as a backup of your suitecrm. Nice work.

Step 3 – Rename the Index file.

In your file manager navigate to this spot:
modules/AOD_Index/Index/

(yes, that’s a lot of indexes!)

Inside this is, no surprise, another index folder! But this is the one we want. Double click on the text and re-name it to ‘index.backup’ from it’s current ‘index’. Just so you know what’s going to happen here is the system will go looking for ‘index’ but because you just renamed it it won’t find it and will create a new one (which is a trick, because that’s what we want, you trickster!). At the same time you’re backing up the old one so bonus.

And that’s it for the work you need to do in your file manager for now.

Step 4 – Stop your Cron Jobs if You Have Them Started (which I’m thinking you do…)

If your Suitecrm is doing workflow stuff and sending alerts, probably your cron jobs are setup so you already know what a cron job is. If not, back up your current cron setting so you can quickly get it up and running again. I just saved this in in a safe place in a text file to use again after completing this stuff.

  • a) go to Cron Jobs in cpanel
  • b) copy and paste the settings you have into the text file and save it safely somewhere
  • c) delete the cron job This makes sure the cron job won’t run while you are doing the next steps. I went a step further, ( not sure if it’s needed ) and changed all my scheduled events in admin/schedules to ‘inactive’ to assure that I could turn them on one at a time later after I turned this on again. I think this was a good move so I’ll advise it next:

Step 5 – Turn all your scheduled jobs in Suite CRM Scheduler to ‘Inactive’

See comments just above.

## Do the Database Work
Ok, now we’re ready to do the stuff that was totally foreign to me but pretty fast and easy once you know how. Go into ‘Phpmyadmin’ section of Cpanel to begin.

Delete Rows from Table aod_index

This one is pretty easy. just find it on the left

… and click it then click the red delete circle and say yes to delete (or was it ‘go’? whatever, you’ll know…)

Delete Rows from aod_indexevent

This next step requires getting rid of WAAAAY too many rows to do by a human. Trust me, I tried before I was forced to find this better and faster way.

This one is a bit more ‘cryptic’ since you have to write a code. But the neat part is yiou know you are doing it right because it auto-fills as you type it.

  • a) go to SQL tab at the top of your Phpmyadmin
  • b) highlight and delete whatever is in that big white query box at the top if there is anything
  • c) Start typing this command and use the tab key (for fun) to autofill when it pops up stuff:

truncate aod_indexevent

  • c) press ‘go’ on the far right
  • d) agree when the warning Do you really want to execute “TRUNCATE aod_indexevent”? comes up

Boom. Done. Now we have to turn everything back on.

Step 6 – Turn Everything Back On

  • 1. your cron job
  • 2. your schedulers in admin, but see note below

Final Notes

There are two important admin schedulers related to your searches which need to index. the main one related to above which I believe broke our Global Search was the ‘Optimize AOD Index’ job. SO, for this one what I did was set it to ‘every 2 hours’ after I did the steps above. This would allow me to see an improvement sooner. Then, once I realized it was fixed, I switched it back to ‘every 14 hours’. I’m not sure what a good amount of time is but that seems to be working well for me. SO maybe you could do the same which will allow you to see if its working sooner. It seemed that by the end of the first day mine was fully working again.

Hope this tutorial helps someone as I don’t have developer skills to pay the project back

Tags : , ,

How to Encrypt a Password Around and Merge Multiple PDFs in Ubuntu

For some reason, this is way harder than it should be. I thought I would be able to find a simple ‘pdf stitcher’ software in the Software Centre and just put them in there, arrange them and then export to PDF – with a password. I think this used to be possible with PDF Sam but anyway. This tutorial will hopefully be a long term and reliable way that we can do this in a pinch from any machine.

This is all terminal based so get ready to pump up your terminal skills.

1. Stick PDFs in a Dedicated Folder

Assemble into one directory all the PDFs you plan to stitch together and wrap up with a password. I think the command will only work if they are in one place so this step is important.

2. Install PDFTK

sudo apt install pdftk… I think… but you might need some other package these days… remind me in comments if this is wrong 🙂

3. Go to your PDF directory

Using the CD (change directory) command, navigate to the directory you made in step 1.

4. Run the Command for One Page Only.

This is the basic format for PDFTk showing one file being output with a new name and a password

pdftk [mydoc_old].pdf output [mydoc_new].pdf user_pw [awesomepasswd]

In this case you”ll swap out the filenames accordingly.

*Special note! do not put the square brackets in there. those are just to show you what needs to be swapped out. I actually did this and wasted a lot of time (lol)

Also, take note of this, you ‘might’ get a warning that the PDF has a user password and you can’t do these tasks because you don’t know the owner password. It seems banks do this on their bank statements, which is funny, because they don’t supply a secure way to send banking documents to them and ask me to email…

Error will look like this if you need to work around it:

filename.pdf
has set an owner password (which is not required to handle this PDF).
You did not supply this password. Please respect any copyright.

I found a nice work around to stick it to these bankers which is to use the Ubuntu ‘print’ (ie. printing to your printer) and then change from your printer to ‘print to file’. Side note: If you didn’t know about this built in and super easy PDF feature and you only need to do one PDF at a time and no encryption, this is the way to do it.

The output PDF from this method seems to strip away any of the ‘owner password’ annyoyances. Hint: this is also a good time to rename your individual pdfs to a number in the order you want them to appear in the final merged PDF. I do 001, 002, 003 during this phase making the next section way, way easier.

5. Run the Command for Merging Multiple PDFs

The process is the same as above, but now that you have your folder full of 001, 002, 003 numbered files, here is what you do:

pdftk [001].pdf [002].pdf [003.pdf] output [mydoc_new].pdf user_pw [awesomepasswd]

Once you hit ‘enter’ a new file will appear in the same directory with name ‘mydoc_new.pdf’ and will have 001, 002, 003 in it and be locked behind the password ‘awesomepasswd’.

Pretty handy especially when you have to deal with ‘owner passwords’ in the PDF.

Hope this helps!

Tags : , , , ,

How to use Onionshare on Ubuntu

Looking for some extra security, privacy and anonymity whens sending files? This might be a neat solution for you.

Currently it seems the instructions for using this interesting Onionshare technology are not super clear so I’m writing up a quick tutorial so others can save a few minutes and set their expectations correctly.

First, how it works is this:

  • You have to use a command line tool for now
  • Onionshare does a bunch of fancy stuff to your file and turns it into a shareable link
  • The person on the other side gets the files by entering that link into a tor browser (not a regular browser – won’t work)
  • You get a .zip file, not the raw file which you download to your local device and extract
  • It seems you only get one chance and if you don’t get the files, the link dies and the sender has to start again.

So, let’s get started:

1. Install Onionshare.

Command line install instructions are in the Ubuntu section here

2. Install Tor browser

I used the Ubuntu Software centre. Probably there are other ways to get it.

3. Convert your file into a shareable and anonymous link

In the terminal, go to where your file is with the CD command and then type:
onionshare filename.txt
Where filename.txt is whatever file it is you are trying to share.

4. Copy Link to clipboard

If you haven’t used a terminal for copying before you’ll need to do control + shift + C (not just control + c)

5. Have sender open link in Tor browser

In this case it’s probably you for the first test so paste the link into the Tor browser.

6. Download the file(s)

It seems you only get one shot and that it won’t download raw file but only compressed package. Also if you aren’t familiar with Tor, I lost some precious time here as well looking on my computer for the file but it downloads into a ‘tor folder’ it seems so use the browser to go find your file in case it didn’t end up where you expected…what I did was find it, and then control + X it to my local machine from there to do the next steps.

7. Extract and Enjoy

Worked for me!

One-Shot Sharing

Try now to click the download files button again. You will see it’s dead.
Try also to use the same share link again. You will see this also is dead.
Kind of cool.

Sending more than one File at Once

So, after sending one file, I tried again to send an entire directory containing a screenshot, a PDF and a music file just to see what happened. I then tried to do the exact command with a regular directory to see if this would be able to handle it but no go. Onionshare appears not to be able to do this. It failed and couldn’t open the end zip file. For the second test I compressed the directory first as a .zip, then sent that via the instructions above and … still no go. When I try to extract it fails.

So it may currently only be able to send single files, but definitely single files work well with these instructions above and if you figured out how to send a directory, throw that in the comments below.

Tags : ,