Created
August 19, 2014 19:31
-
-
Save spinegar/ce52c041fc4aab5c2508 to your computer and use it in GitHub Desktop.
A script to index ElasticSearch after performing Sugar database work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('vendor/autoload.php'); | |
$sugar = new \Spinegar\Sugar7Wrapper\Rest(); | |
$sugar->setUrl('https://sugar/rest/v10/') | |
->setUsername('admin') | |
->setPassword('secretpassword') | |
->connect(); | |
$modules = ['Accounts', 'Opportunities', 'Cases', 'Leads', 'Contacts', 'Bugs', 'Products', 'Notes', 'Calls', 'Meetings', 'Manufacturers', 'Products', 'ProductCategories', 'RevenueLineItems', 'Documents', 'Emails', 'Reports', 'Manufacturers']; | |
foreach($modules as $module) | |
{ | |
echo "Indexing " . $module . "... "; | |
$records = $sugar->search($module); | |
foreach($records['records'] as $record) | |
{ | |
$sugar->update($module, $record['id'], []); | |
} | |
echo "Done. <br /><br />"; | |
} | |
echo "Indexing Complete!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment