diff options
| -rw-r--r-- | gentoobrowse-api/service/maintenanceimpl.cpp | 21 | ||||
| -rw-r--r-- | gentoobrowse-api/service/maintenanceimpl.h | 3 | 
2 files changed, 10 insertions, 14 deletions
| diff --git a/gentoobrowse-api/service/maintenanceimpl.cpp b/gentoobrowse-api/service/maintenanceimpl.cpp index eddf2b2..3e8f8f9 100644 --- a/gentoobrowse-api/service/maintenanceimpl.cpp +++ b/gentoobrowse-api/service/maintenanceimpl.cpp @@ -13,14 +13,6 @@ namespace Gentoo {  		{  		} -		FilePtr -		Maintenance::findInPath(const std::string & p) -		{ -			AdHoc::Buffer find; -			find.appendbf("(cd %s && find * -type f -printf \"%%p\t%%s\t%%TFT%%TT\\n\" -follow)", p); -			return FilePtr(popen(find, "r"), pclose); -		} -  		static  		void  		fileDeleted(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s) @@ -60,9 +52,16 @@ namespace Gentoo {  					boost::filesystem::create_symlink(p, tmp / n);  				});  			dbc->execute(sql::maintenance::createTempFileListTable::sql); -			dbc->beginBulkUpload("filelist", ""); -			dbc->bulkUploadData(findInPath(tmp.string()).get()); -			dbc->endBulkUpload(nullptr); +			auto i = dbc->modify("INSERT INTO filelist(filename, filesize, filemtime) VALUES(?, ?, ?)"); +			for (boost::filesystem::recursive_directory_iterator d(tmp, boost::filesystem::symlink_option::recurse); +					d != boost::filesystem::recursive_directory_iterator(); d++) { +				if (boost::filesystem::is_regular_file(d->status())) { +					i->bindParamS(0, d->path().lexically_relative(tmp).string()); +					i->bindParamI(1, boost::filesystem::file_size(*d)); +					i->bindParamT(2, boost::posix_time::from_time_t(boost::filesystem::last_write_time(*d))); +					i->execute(); +				} +			}  			dbc->execute(sql::maintenance::createTempFileListView::sql);  		} diff --git a/gentoobrowse-api/service/maintenanceimpl.h b/gentoobrowse-api/service/maintenanceimpl.h index c5ad6b7..19b2872 100644 --- a/gentoobrowse-api/service/maintenanceimpl.h +++ b/gentoobrowse-api/service/maintenanceimpl.h @@ -6,8 +6,6 @@  #include <abstractDatabaseClient.h>  namespace Gentoo { -	typedef boost::shared_ptr<FILE> FilePtr; -  	namespace Service {  		class DLL_PUBLIC Maintenance : public Gentoo::Maintenance, IceTray::AbstractDatabaseClient {  			public: @@ -18,7 +16,6 @@ namespace Gentoo {  			private:  				static void createTempFileList(DB::Connection *, const boost::filesystem::path &);  				static void processChanges(DB::Connection *, const boost::filesystem::path &); -				static FilePtr findInPath(const std::string &);  		};  	}  } | 
